I wana write a php menu system for my portal and i need to submit all the input box by just clicking only on one button
this is my code !?
Code: Select all
echo "<form action=\"\" method=\"POST\">
<table border=\"0\" align=\"center\" width=\"100%\">
<tr>
<td bgcolor=\"#F0F0F0\" width=\"15%\"> <b>name</b></td>
<td bgcolor=\"#F0F0F0\" width=\"15%\"> <b>url</b></td>
<td bgcolor=\"#F0F0F0\" > <b>category</b></td>
<td bgcolor=\"#F0F0F0\" align=\"center\"> <b>place number</b> </td>
</tr>";
/* $num = $db->sql_numrows($db->sql_query("SELECT mid FROM fgh_menu"));if ($num = 0) {}
$sql =$db->sql_query("SELECT * FROM fgh_menu_items where active=0");
while ($row = $db->sql_fetchrow($sql)) {
$tid = intval($row['tid']);
$title = $row['title'];
$url = $row['url'];*/
$act =$db->sql_query("SELECT * FROM menu_items where active=1");
while ($row = $db->sql_fetchrow($act)) {
$title = $row['title'];
$url = $row['url'];
$etid = intval($row['tid']);
$act2 =$db->sql_query("SELECT * FROM menu where tid='$etid'");
while ($row4 = $db->sql_fetchrow($act2)) {
$cid = intval($row4['cid']);
$mid = intval($row4['mid']);
}
echo "<form method=\"post\" action=\"admin.php?op=fghMenu\" ><tr onMouseOver=\"this.style.backgroundColor='#FFFFB9';\" onMouseOut=\"this.style.backgroundColor='#ECFAFF';\"
onclick=\"this.style.backgroundColor='#FFFF0D';\">
<td ><input type='text' dir='rtl' name='title' id='title' size='20' maxlength='20' value='$title'></td>
<td ><input type='text' dir='rtl' name='url' id='url' size='20' maxlength='20' value='$url'></td>
<td ><input type='text' dir='rtl' name='etid' id='etid' size='5' maxlength='5' value='$etid'></td>
<td >";
SelectCategory();
echo "</td >";
echo "<td >
<input name='em' id='em' type=\"submit\" value='update'></td>";
}
echo "</tr></table>";
if( isset($_POST['em'])){
while($counter<=($_POST['etid']-1)){
$title = mysql_real_escape_string($_POST['title']);
$url = mysql_real_escape_string($_POST['url']);
$etid = $_POST['etid'];
$cat_id = $_POST['cat_id'];
$result2 = $db->sql_query("UPDATE fgh_menu SET cid='$cat_id' where tid='$etid'");
$counter++;}
}
but when i click the button it just update one row
help me with the code
thank you