Note that there are some explanatory texts on larger screens.

plurals
  1. POReorder pages in a menu system
    primarykey
    data
    text
    <p>I have written a chunk of code that is aimed at reordering pages.</p> <pre><code>&lt;form action="process.php" method="post" /&gt; &lt;?php $apageid = array(); $apagename = array(); $q = "SELECT g.id, g.title, n.order FROM tbl_general g INNER JOIN tbl_navigation n ON n.pageid = g.id WHERE n.type = '$_SESSION[parent]'"; $return = $database-&gt;query($q); while($row=mysql_fetch_assoc($return)){ $apageid[] = $row['id']; $apagename[] = $row['title']; $apageorder[] = $row['order']; } $count = count($pageid); $bpageid = array(); $bpageorder = array(); //run through each page one at a time and update the order of the menu for($i=0; $i++; $i&lt;$count){ //set a few variables $pid = $pageid[$i]; $porder = $pageorder[$i]; ?&gt; &lt;select name="&lt;?php $bpageid[$i] ?&gt;"&gt; &lt;?php for($j=0; $j++; $j&lt;$count){ ?&gt; &lt;option value="&lt;?php $apageid[$j] ?&gt;"&gt;&lt;?php echo $apagename[$j]; ?&gt;&lt;/option&gt; &lt;?php } ?&gt; &lt;/select&gt; &lt;select name="&lt;?php $bpageorder[$i] ?&gt;"&gt; &lt;?php for($j=0; $j++; $j&lt;$count){ ?&gt; &lt;option value="&lt;?php $apageorder[$j] ?&gt;"&gt;&lt;?php echo $apageorder[$j]; ?&gt;&lt;/option&gt; &lt;?php } ?&gt; &lt;/select&gt; &lt;?php } ?&gt; &lt;input type="submit" name="navigation" value="Reorder pages" /&gt; &lt;/form&gt; </code></pre> <p>For example, if there were 7 menu items, the code should loop through all 7 and display 7 dropdown boxes each with the 7 options within. Next to each dropdown should be the numbers 1-7 which are the order of the boxes. This would allow each dropdown to pick a menu item and assign the order number to it.</p> <p>Of course, when the script is submitted, I'll validate that two items don't clash etc etc.</p> <p>The code currently isn't displaying anything but the submit button.</p> <p>Can anyone see the problem I have?</p> <p>Thanks</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload