Re: Forms

From: Date: Wed, 11 Dec 2002 03:58:36 +0000
Subject: Re: Forms
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-127802@lists.php.net to get a copy of this message
> <P><CENTER><FORM NAME="Employees"> > <SELECT NAME="name"> > <OPTION SELECTED VALUE=""></OPTION> > <OPTION VALUE="John"</OPTION>John > <OPTION VALUE="Mary"</OPTION>Mary > </SELECT> > <INPUT TYPE="submit" VALUE="Submit"> TIA: You are missing the action and method attributes to the form tag. You are also missing the closing form tag. I don't know if you accidentally omitted these when posting your question or if you are actually missing these in your actual HTML code as well. Your code should look something like this: <FORM NAME="Employees" ACTION="form-processor.php" METHOD="POST"> // You could also use METHOD="GET" <SELECT NAME="name"> <OPTION SELECTED VALUE=""></OPTION> <OPTION VALUE="John"</OPTION>John <OPTION VALUE="Mary"</OPTION>Mary </SELECT> <INPUT TYPE="submit" VALUE="Submit"> </FORM> If you've got all of this in place, but you are still having trouble gaining access to the variable, it may be that you are using a newer version of PHP which requires you to access the variable a different way. Try this: <?php $employee = $HTTP_POST_VARS["name"]; // Or $HTTP_GET_VARS if you are using GET to pass the variables. ?> Hope this helps, Christopher

« previous php.general (#127802) next »