function getMenuItem($MenuID, $userID) { try { include_once 'dbConnect.php'; $dbh = OpenConn(); $stmt = $dbh->prepare("SELECT * FROM tMenu where MenuID=?"); if ($stmt->execute(array($MenuID))) { while ($row = $stmt->fetch()) { echo "<form id='edit' method='post' action='editMenu.php?u={$userID}' autocomplete='on'>"; echo "<input type='hidden' id='MenuID' name='MenuID' value='{$MenuID}'>"; echo "<input type='hidden' id='action' name='action' value='edit'/>"; $MenuName = $row['MenuName']; echo "<br />Menu Item Name: <input type='text' name='MenuName' id='MenuName' value='{$MenuName}' />"; $PagePath = $row['PagePath']; echo "<br />Page Path: <input type='text' name='PagePath' id='PagePath' value='{$PagePath}' />"; $Sequence = $row['Sequence']; echo "<br />Sequence: <input type='text' name='Sequence' id='Sequence' value='{$Sequence}' />"; echo "<br />Requires Authentication: "; $RequiresAuthentication = $row['RequiresAuthentication']; echo "<input type = 'radio' name='RequiresAuthentication' id='RequiresAuthentication' value='1' "; if ($RequiresAuthentication == 1) { echo " checked='checked' "; } echo "/> Yes "; echo "<input type = 'radio' name='RequiresAuthentication' id='RequiresAuthentication' value='0' "; if ($RequiresAuthentication == 0) { echo " checked='checked' "; } echo "/> No "; $ParentItem = $row['ParentItem']; getMenuDropDown($ParentItem); echo "<br />Color: "; $Color = $row['Color']; echo "<input type = 'radio' name='Color' id='Color' value='black' "; if ($Color == "black") { echo " checked='checked' "; } echo "/> black "; echo "<input type = 'radio' name='Color' id='Color' value='white' "; if ($Color == "white") { echo " checked='checked' "; } echo "/> white "; echo "<input type = 'radio' name='Color' id='Color' value='grey' "; if ($Color == "grey") { echo " checked='checked' "; } echo "/> grey "; $QueryString = $row['QueryString']; echo "<br />Query String: <input type='text' id='QueryString' name='QueryString' value='{$QueryString}' />"; echo "<br /><input type='submit' name='update' value='update' />"; echo "</form>"; } $dbh = null; } } catch (PDOException $e) { print "Error!: " . $e->getMessage() . "<br/>"; die; } }
<div class="modal fade bs-modal-sm" id="menuItemModal" tabindex="-1" role="dialog" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true" onclick="clearMenuItemValues();">×</button> <h4 class="modal-title">Add/Edit MenuItems</h4> </div> <div class="modal-body"> <div class="row"> <div class="col-md-12"> <div class="form-group"> <label>Menu Name</label> <div> <?php $result = getMenuDropDown(); echo '<select class="form-control" id="menuMenuID" name="menuMenuID">'; echo '<option value="0">Select Menu</option>'; while ($menurow = mysqli_fetch_assoc($result)) { echo '<option value="' . $menurow['menuID'] . '">' . $menurow['menuName'] . '</option>'; } $mysqli->close(); echo '</select>'; ?> </div> </div> <div class="form-group"> <label>Menu Item Name</label> <div> <input type="hidden" class="form-control" name="menuItemID" id="menuItemID" value="0">