Hello, I was learning how to use PHP with html forms and I'm having some problems. I think it might be some kind of syntax screwup because it's kind of simple :o .
The form:
<FORM METHOD="GET" ACTION="results.html">
Enter your first name:<BR>
<INPUT NAME="firstName" TYPE="TEXT">
<BR><BR>
Enter your last name:<BR>
<INPUT NAME="lastName" TYPE="TEXT">
<BR><BR>
Choose your favorite teams:<BR>
<SELECT NAME="teams[]" MULTIPLE="TRUE">
<OPTION>Cincinnati Reds</OPTION>
<OPTION>Cincinnati Bengals</OPTION>
<OPTION>Ohio State Buckeyes</OPTION>
</SELECT>
<BR><BR>
<INPUT TYPE="SUBMIT" VALUE="Submit"><INPUT TYPE="RESET" VALUE="Reset">
</form>
the page that displays the results (results.html):
<?php
echo "Hello, " , $_GET["firstName"] , " " . $_GET["lastName"] , ".<BR>These are your favorite teams:<BR>";
foreach ($_GET["team"] as $teamSelected){
echo $teamSelected, "<BR>";
}
?>
Thanks for your help. Also, two questions: what exactly is the difference between the "get" and "post" methods for forms? The book I'm reading makes it seem like they are the same thing, and you should use $_REQUEST to get both. Second, when exactly do you give a file the .php extension? I know PHP will "interpret" from inside an html file, so why name it .php? Is there some kind of convention? Thanks.
Edit: sorry, forgot to say. I'm using PHP 5, and the form part at least looks fine (as in when I view it in a browser.)