1 00:00:00,000 --> 00:00:00,140 2 00:00:00,140 --> 00:00:02,560 >> SPEAKER: Let's improve upon the website that I'm making for freshman, 3 00:00:02,560 --> 00:00:06,460 via which they can register for intramural sports in two ways, one 4 00:00:06,460 --> 00:00:08,590 aesthetically, and two, functionally. 5 00:00:08,590 --> 00:00:13,080 In particular, let's take a look at this source in froshims-1.php. 6 00:00:13,080 --> 00:00:16,810 Notice that the only changes I've made right now are to change the action of 7 00:00:16,810 --> 00:00:22,580 this form to register-1.php, and to add in this line here, a link tag 8 00:00:22,580 --> 00:00:28,020 whose href is the path to a file called bootstrap.min.css. 9 00:00:28,020 --> 00:00:31,960 It turns out that bootstrap is simply a library for CSS that makes it much 10 00:00:31,960 --> 00:00:35,840 easier to make prettier websites than you might otherwise get by default. 11 00:00:35,840 --> 00:00:38,990 >> Let's now take a look at register-1.php. 12 00:00:38,990 --> 00:00:43,280 Atop this file, notice that I've added this "if" construct. 13 00:00:43,280 --> 00:00:48,690 If the value of name inside of the POST superglobal is empty, or if the 14 00:00:48,690 --> 00:00:53,300 value of gender inside of the POST superglobal is empty, or if the value 15 00:00:53,300 --> 00:00:57,750 of dorm inside of the POST superglobal is empty, then I'm executing a 16 00:00:57,750 --> 00:00:59,090 function called header. 17 00:00:59,090 --> 00:01:03,600 But specifically, I'm sending via this function an HTTP header called 18 00:01:03,600 --> 00:01:07,790 location after whose colon is the URL to which I'd like to 19 00:01:07,790 --> 00:01:09,520 redirect the user. 20 00:01:09,520 --> 00:01:12,990 Then I immediately call exist because, if I intend to redirect the user to 21 00:01:12,990 --> 00:01:17,100 some other URL, I don't want any additional code, or even HTML, in this 22 00:01:17,100 --> 00:01:19,660 file, to be sent ultimately to the user. 23 00:01:19,660 --> 00:01:22,070 >> Let's now take a look in a browser. 24 00:01:22,070 --> 00:01:25,560 Notice first, already, that this form is much prettier than my previous 25 00:01:25,560 --> 00:01:27,300 version, all thanks to bootstrap. 26 00:01:27,300 --> 00:01:30,620 Let's now proceed to fill out this form, but incompletely, so that we can 27 00:01:30,620 --> 00:01:35,640 trigger that "if" block to actually redirect me back to froshims-1. 28 00:01:35,640 --> 00:01:38,020 >> Let's go ahead and provide my name as intended. 29 00:01:38,020 --> 00:01:39,590 Sure, I'll be a captain. 30 00:01:39,590 --> 00:01:41,510 I'll specify myself as male. 31 00:01:41,510 --> 00:01:44,220 But I'll lazily forget to actually provide my dorm. 32 00:01:44,220 --> 00:01:45,860 Let's now click Register. 33 00:01:45,860 --> 00:01:48,860 >> Now notice I've immediately been redirected back to this form. 34 00:01:48,860 --> 00:01:50,880 But that's exactly as we intended. 35 00:01:50,880 --> 00:01:55,480 Recall, after all, that in register-1.php, if any of name or 36 00:01:55,480 --> 00:02:00,170 gender or dorm are empty, that is the user failed to provide a non-empty 37 00:02:00,170 --> 00:02:05,060 value, then we would indeed redirect the user back to that same URL for 38 00:02:05,060 --> 00:02:07,340 froshims-1.php. 39 00:02:07,340 --> 00:02:12,100 Only if a user his or her name and gender and dorm will they be allowed 40 00:02:12,100 --> 00:02:13,350 to actually register. 41 00:02:13,350 --> 00:02:15,702