Re: regarding form submission and option pull down menu

From: Date: Tue, 02 Aug 2005 14:08:05 +0000
Subject: Re: regarding form submission and option pull down menu
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-219825@lists.php.net to get a copy of this message
Bruce Gilbert wrote:
a few more questions about the submission process for a form with option choices. say I am using : <form method="POST" action="$_SERVER['PHP_SELF']" class="application"> <select class="checkbox"
                        name="loan_process">
<option value="Purchase"                           selected="selected">Purchase</option>
                      <option                           value="construct_home">Construct Home</option>
                      <option
                          value="refinance_no_cash">Refinance - No Cash</option>
                      <option
                          value="refinance_cash_out">Refinance - Cash
Out</option> </select> </form> is it better to use a name for value (the same as the selection choice) or a number 1,2,3 etc? (or does it matter).
it's your data - you decide - personally IDGAF. just make sure you santize your incoming data whatever form you expect it in.
and for the return info what's the difference between: <?php if(isset($_POST["loan_process"])) echo $_POST["loan_process"]; ?> and without the isset?
do you know what an if statement is? have you looked at the manual page for isset()? do you know what a E_NOTICE is? the short answer is: difference is 1 line of code, the longer answer is: read some more of the manual and learn about error checking (the most simple form being to simply check that a variable exists before trying to use it.)
thanks!


« previous php.general (#219825) next »