
Here is my code
<?php
echo $row['valveName'].'<td>'.$row['valveId'].'<td>';
echo '<select name="onoff">';
echo '<option value="ON">ON';
echo '</option>';
echo '<option value="OFF">OFF';
echo '</option>';
echo '</select>';
?>
<tr>
<td>
<input type="submit" name="Submit" align="bottom" border="2" >
</tr>
<?php
if (isset($_POST['Submit'])) {
$change=$_POST[onoff];
echo $change;
}
/* $selection=$_REQUEST[onoff];
switch($selection)
{
case "1" :
$change="ON";
echo $change;
break;
case "2" :
$change="OFF";
echo $change;
}
*/
$query_auto="UPDATE valve set position='".mysql_real_escape_string($change)."' where valveName='$select1'";
mysql_query($query_auto) or die(mysql_error());42
but $change has a null value
thanks
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.