Visit the Official PHP Website |
PHP ProgrammingBy James N HitzGetting HTML-form dataPHP is smart! It scans the "calling" form and reads all the name and value attributes, it adds a dolar sign($) before every name and... Bingo! Ladies and Gentlemen, we have variables! What?! It's that simple? Yeah! It's that simple. All names are converted into variables with the values of course assigned to their respective variables. Consider the previous form. Supposing a certain user filled it thus: Name: James Hitz(username) When the user hits the submit button (OK in our form), the PHP script specified in the action (/php-bin/person.php) is executed. It automatically creates the following variables: $username $usermail $Mstatus Lets actually create the person.php script to thank the user for filing in the form. <HTML><HEAD><TITLE>Thank you </TITLE></HEAD><BODY> <H2>Thank you</H2> <?php print "Thank you <B> $username</B> for your submission. ". "Your submission indicates that you are $Mstatus and". " your email address is <B>$username."; ?> </BODY></HTML> using the above data entry. the result will be: Thank youThank you James Hitz for your submission. Your submission indicates that you are single and your email address is james@ncts.zzn.com Challenge: What if the user doesn't enter data in the form but hits submit anyway? What then? |
JamHitz Productions