>> SPEAKER: Let's improve upon the website that I'm making for freshman,
via which they can register for intramural sports in two ways, one
aesthetically, and two, functionally.
In particular, let's take a look at this source in froshims-1.php.
Notice that the only changes I've made right now are to change the action of
this form to register-1.php, and to add in this line here, a link tag
whose href is the path to a file called bootstrap.min.css.
It turns out that bootstrap is simply a library for CSS that makes it much
easier to make prettier websites than you might otherwise get by default.
>> Let's now take a look at register-1.php.
Atop this file, notice that I've added this "if" construct.
If the value of name inside of the POST superglobal is empty, or if the
value of gender inside of the POST superglobal is empty, or if the value
of dorm inside of the POST superglobal is empty, then I'm executing a
function called header.
But specifically, I'm sending via this function an HTTP header called
location after whose colon is the URL to which I'd like to
redirect the user.
Then I immediately call exist because, if I intend to redirect the user to
some other URL, I don't want any additional code, or even HTML, in this
file, to be sent ultimately to the user.
>> Let's now take a look in a browser.
Notice first, already, that this form is much prettier than my previous
version, all thanks to bootstrap.
Let's now proceed to fill out this form, but incompletely, so that we can
trigger that "if" block to actually redirect me back to froshims-1.
>> Let's go ahead and provide my name as intended.
Sure, I'll be a captain.
I'll specify myself as male.
But I'll lazily forget to actually provide my dorm.
Let's now click Register.
>> Now notice I've immediately been redirected back to this form.
But that's exactly as we intended.
Recall, after all, that in register-1.php, if any of name or
gender or dorm are empty, that is the user failed to provide a non-empty
value, then we would indeed redirect the user back to that same URL for
froshims-1.php.
Only if a user his or her name and gender and dorm will they be allowed
to actually register.