Re: Return value in Combo Box

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ahmed Abdel-Aliem wrote:
can anyone please tell me how to make the choice the user selected in
the combo box be selected when the validation page redirects to the
form again ?

One way is to do it like this:

<select name="foo">
<option value="1"<?php if ($_POST['foo'] == '1') { echo ' selected="selected"'; } ?>>Foo</option>
<option value="2"<?php if ($_POST['foo'] == '2') { echo ' selected="selected"'; } ?>>Bar</option>
</select>


Another option is to use something like PEAR::HTML_QuickForm, which can do the validation for you: <http://pear.php.net/package/HTML_QuickForm>

--
Ben Ramsey
Zend Certified Engineer
http://benramsey.com

---------------------------------------------------
Atlanta PHP - http://www.atlphp.org/
The Southeast's premier PHP community.
---------------------------------------------------

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux