Re: Forms Question

From: Date: Fri, 07 Sep 2001 12:18:15 +0000
Subject: Re: Forms Question
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-12246@lists.php.net to get a copy of this message
I would think you would want the "name" of your select to be "store" and not "$store". That way the value will be in the variable $store when the form is submitted. Now, as I understand, what you want is for the value of $store from the database to be preselected when the form is displayed. You can do that by modifying your code as follows: > while ($row=mysql_fetch_array($result)) { > $store=$row["store"]; > $jobdesc=$row["jobdesc"]; > echo "<FORM METHOD=post ACTION=update.php>"; > echo "<P>Store: > <Select NAME=\"store\"> <-- remove "$" <option VALUE=\"$store\" selected>$store <-- add this line <option VALUE=\"\"> --- <-- add this line > <option VALUE=\"Signal Hill\">Signal Hill > <option VALUE=\"Reseda\">Reseda > <option VALUE=\"Orange\">Orange > <option VALUE=\"West Covina\">West Covina > <option VALUE=\"Riverside\">Riverside > <option VALUE=\"Norwalk\">Norwalk > <option VALUE=\"Fountain Valley\">Fountain Valley > <option VALUE=\"Pasadena\">Pasadena > <option VALUE=\"Redondo Beach\">Redondo Beach > <option VALUE=\"San Bernardino\">San Bernardino > <option VALUE=\"Kearny Mesa\">Kearny Mesa > <option VALUE=\"San Marcos\">San Marcos > <option VALUE=\"Chino\">Chino > <option VALUE=\"Coporate Office\">Corporate Office > </select></P>"; > echo "<P><INPUT TYPE=text SIZE=35 NAME=\"Jobdesc\" > VALUE=\"$jobdesc\"></P>"; > echo "<p><INPUT TYPE=submit VALUE=\"submit\" LABEL=\"Save > Changes\"></P>"; > } The store that is in the database will be listed twice -- at the top of the list, and then in its normal position in the list. The "---" line is just to serve as a visual seperator between the selected store and the complete list of stores, for the person filling out the form.

« previous php.db (#12246) next »