hey guys,,could you help me bout my problem? I want to make a function and i want to preselect its ID's not its values,,

this is my code

function getVisibility(){
echo "<option id=0>Inactive</option>
<option id=1>Active</option>
<option id=2>Active on Website</option>
<option id=3>active on churchwide calendar</option>";


I want to pass the ids to update my table in the database and the value should be 0,1,2,3 not the active,inactive........


sql="Update weeklyevent SET visibility=$evisibility where weid=$weid";

8 Years
Discussion Span
Last Post by smartness

I don't fully understand what you are trying to accomplish...

Are you trying to use PHP to generate a form based off of data you pull from a table in a database?

Edited by Rkeast: n/a


Shouldn't this be:

function getVisibility(){
echo "<option value='0'>Inactive</option>
<option value ='1'>Active</option> 
<option value ='2'>Active on Website</option>
<option value ='3'>active on churchwide calendar</option>";

The $_POST array will now store the option 'value' attribute (in the select 'name'/'id' $_POST key).

$array = $_POST;
foreach($array as $values => $value) {
	//echo $value.'<br />';
	$value = trim($value);
//Everything except the "sumbit" button
		if($value != "Submit") { 
	$result = mysql_query("INSERT INTO `table` (`field`) VALUES ('$value')", $connection);



This is something i Use to get values for multiple checkboxes, and then i query them into the Db! of course you can do whatever you want with them!

Edited by smartness: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.