Simple Update Form Not Doing Its Job
Posted: Mon Feb 27, 2006 12:57 am
Hello,
Ive got a page that displays all of the rows. It puts it into a form also that updates the row.
It doesnt work the form method. But it works manually. I cant seem to figure it out. Ive had it working before.
display.php
also any ideas on making this script better, please tell me
updatemuot.php
It works when I do it manually, but not the form method.
Thank You!
Ive got a page that displays all of the rows. It puts it into a form also that updates the row.
It doesnt work the form method. But it works manually. I cant seem to figure it out. Ive had it working before.
display.php
Code: Select all
$username2= "muot_report";
$password2= "report";
$database2= "muot_report";
$connection2 = mysql_connect('localhost',$username2,$password2);
mysql_select_db($database2);
$sql = "SELECT *
FROM `report`";
$query = mysql_query($sql);
while($row = mysql_fetch_array($query)) {
echo '<table border=0><form method=post action=/site/muotReport/updateMuot.php>';
echo '<tr><td valign=center>';
echo $row['Code'];
echo '</td></tr>';
echo '<input type=hidden name=switch value=';
echo $row['Number'];
echo '>';
echo '</td></tr>';
echo '<tr><td align=center><input type=submit value="Set As Default Muot"></tr></td>';
echo '</table>';
echo '<br><br>';
};
mysql_close($connection2);updatemuot.php
Code: Select all
$username2= "muot_report";
$password2= "report";
$database2= "muot_report";
$connection2 = mysql_connect('localhost',$username2,$password2);
mysql_select_db($database2);
mysql_query('UPDATE report set `Live` = 0');
mysql_query('UPDATE report set `Live` = 1 WHERE `Number` ='.$switch);Thank You!