<?php $BY = stripslashes($_GET['BY']); if(!$BY) { $BY = '00'; } $query_Rs_edit = "SELECT * FROM menuliste WHERE menunavn = $BY"; $Rs_edit = mysql_query($query_Rs_edit, $menuliste); $row_Rs_edit = mysql_fetch_assoc($Rs_edit); $totalRows_Rs_edit = mysql_num_rows($Rs_edit); ?> <?php if($_SERVER['REQUEST_METHOD'] == "POST") { if(!$error) { } $q = mysql_query("UPDATE `menuliste` SET `menunr`='".mysql_real_escape_string($_POST["menunr"])."', `menunavn`='".mysql_real_escape_string($_POST["menunavn"])."', `pris`='".mysql_real_escape_string($_POST["pris"])."', `gruppe`='".mysql_real_escape_string($_POST["gruppe"])."' WHERE menunavn = $by") or die(mysql_error()); $_SESSION["updated"] = "<p><b>Menuen er Rettet!</b></p>"; session_write_close(); header("Refresh: 0"); ob_end_flush(); //$messageArray[] = "Menuen er Rettet!"; } ?> </head> <body> <table align="center" border="1" cellpadding="0" cellspacing="0" class="layout"> <tr> <td colspan="2" class="top1" border="1" align="center"><h1>Admin</h1></td> </tr> <tr> <td class="topmenu" border="1"><?php include ("menu.php") ?> </td> </tr> <tr valign="top"> <td class="middle" align="center"><p> </p> <?php if(is_array($messageArray)) { foreach($messageArray AS $value) { echo $value."<br />"; } } echo $_SESSION['updated']; $_SESSION["updated"] = " "; ?> <form action="" method="post"> <table style="width:350px;" cellpadding="0" cellspacing="3"> <tr> <td></td> <td colspan="2" align="left"><h2>Redt Menu</h2></td> </tr> <tr> <td align="left">Menunavn</td> <td align="left"> <?php { $sql = mysql_query("SELECT menunavn FROM menuliste"); echo "<select name=\"menunavn\">"; while(list($menunavn)=mysql_fetch_array($sql)) { $menulist= stripslashes($menunavn); echo "<option value=\"$id\""; echo ">$menunavn</option>"; } echo "</select>"; mysql_free_result($sql); } ?> </td> </td> </tr> <tr> <td align="left">Menunr</td> <td align="left"><input name="menunr" type="text" id="menunr" onkeyup="checkForm(this.id)" value="<?php echo $row_Rs_edit['menunr']; ?>" /></td> </tr> <tr> <td align="left">Menunavn</td> <td align="left"><input name="menunavn" type="text" id="menunavn" onkeyup="checkForm(this.id)" value="<?php echo $row_Rs_edit['menunavn']; ?>" /></td> </tr> <tr> <td align="left">Pris</td> <td align="left"><input name="pris" type="text" id="pris" onkeyup="checkForm(this.id)" value="<?php echo $row_Rs_edit['pris']; ?>" /></td> </tr><tr> <td align="left">Gruppe</td> <td><select name="grupper" id="grupper" title="<?php echo $row_Rs_edit['grupper']; ?>" type="text" onkeyup="checkForm(this.id)"> <option value="1">Pølser</option> <option value="2">Burger</option> <option value="3">Pita</option> <option value="4">Byens Grill Speciel</option> <option value="5">Kylling</option> <option value="6">Fiskefiler</option> <option value="7">Diverse</option> <option value="8">Drikkevare</option> </select> </td> </tr><tr> <td colspan="2" align="left"><input name="Submit" type="submit" id="Submit" value="Gem data"></td> </tr> </table> </form> </div> </div> <h1> </h1></td> </tr> </table> <?php mysql_free_result($Rs_edit); ?>