Return to Snippet

Revision: 8745
at October 5, 2008 00:04 by davidsword


Initial Code
//applicable values
$values = array('value1', 'value2', 'value3', 'value4', 'value5'); 
//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>";

Initial URL
http://davidsword.ca/?library

Initial Description
Pre-selects an html form with a requested value... ie; editing a form from a database

Initial Title
Pre-Select HTML Select Form

Initial Tags
php, html, array

Initial Language
PHP