Creating Admin form to select and insert menus in an dynamic tree

Codes here !

Moderators: egami, macek, gesf

Post Reply
anurudee
New php-forum User
New php-forum User
Posts: 2
Joined: Mon Nov 06, 2017 5:13 am

Mon Nov 06, 2017 5:48 am

Hi Team,

I am stuck on a code where I am able to add the first menu & select those menus in a drop-down for adding sub-menus of it.

PHP Code:

This one works and creates menu with Parent ID "0"

<form method="post">
<input type="text" required placeholder="menu name :" name="menu name" /><br />
<button type="submit" name="add_main_menu" >Add main menu</button>
</form><br>

BUT this one gives me menu to select yet doesn't insets the sub menu with id as reference.

<form method="post">
<select name="parent">
<option selected="selected">Select Main Menu</option>
<?php
$res=$dbcon->query("SELECT * FROM accordion");
while($row=$res->fetch_array())
{
?>
<option value="<?php echo $row['id']; ?>"><?php echo $row['menu']; ?></option>
<?php
}
?>
</select><br />
<input type="text" placeholder="menu name :" name="add_first_menu" /><br />
<button type="submit" name="add_first_menu">Add first menu</button>
</form>

Post Reply