/ Published in: PHP

Pre-selects an html form with a requested value... ie; editing a form from a database
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
//applicable values //get current value $val = $_REQUEST['value']; //print html selection echo "<select>"; foreach($values as $v) { $s = ($val == $v) ? " selected='selected'" : null; echo "<option$s>$v</option>\n", } echo "</select>";
URL: http://davidsword.ca/?library
Comments
