I have a sequence of drop down menus but I don't know how I can store the responses in other variables. Right now the output I'm getting looks like
location1 [status1] [change]
location2 [status2] [change]
location3 [status3] [change]
.
.
.
.
where all the [status] are drop down menus and the [change] is a submit box. I'd like to use the change button to change the status of the location in the mysql database. How can I at least get my hands on the location that they modified and the new status of that location?
<?php
$link = @mysql_connect('localhost', 'root', 'password') or
die("Could not connect to MySQL");
$db = @mysql_select_db('temp1',$link) or
die("Could not select database");
$query = "SELECT * FROM table1";
$result = @mysql_query($query,$link) or
die("Could not submit query");
$numrows = @mysql_num_rows($result);
for ($i=0; $i<$numrows; $i++)
{
$infov = mysql_fetch_array($result);
print ("Location: "."$infov[location]");
echo("$i");
dropmenu($infov);
echo('<br>');
}
exit("bye");
?>
<?php
function dropmenu($vector)
{
?>
<SELECT NAME="state" SIZE="1">
<OPTION <?php other($vector,1) ?> VALUE="1">ACTIVE</OPTION>
<OPTION <?php other($vector,2) ?> VALUE="2">BROKEN</OPTION>
<OPTION <?php other($vector,3) ?> VALUE="3"">PLANNED</OPTION>
</SELECT>
<input type="submit" value="change"/>
<?php
echo("$vector[status]");
}
?>
<?php
function other($vector,$int)
{
if($vector[status]==$int)
{
echo('selected');
}
}
?>