Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Finally just had to figure it out on my own, but thanks for those who tried to help. </p> <p>I will post my middle table from my Class/Category/Style/Type cascading tables. First make a function such as the below: </p> <pre><code> &lt;?php //Category Selection function Category_Selection($link) { global $connection; $options=""; if(isset($_GET["class_id"])) { $query="SELECT categories.category_id, categories.Category_Name "; $query.="FROM categories "; $query.="ORDER BY categories.Category_Name ASC"; $result=mysql_query($query, $connection); $class_id=$_GET['class_id']; if(!$result){ die("Database query failed: " . mysql_error()); } while ($row=mysql_fetch_array($result)) { $name=$row["Category_Name"]; $id=$row["category_id"]; $link2=$link."&amp;category_id={$id}"; $options.="&lt;OPTION VALUE=\"$link2\" "; if(isset($_GET["category_id"])) { $category_id = $_GET['category_id']; if($id==$category_id) { $options.=" selected=\"selected\" "; } } $options.=" &gt;".$name.'&lt;/OPTION&gt;'; } } else { $options.="&lt;OPTION selected=\"selected\" VALUE=0&gt;First Select Class&lt;/OPTION&gt;"; } return($options); } ?&gt; </code></pre> <p>Then place on your main page:</p> <pre><code>&lt;?php session_start() ?&gt; //Category if(isset($_GET['category_id'])) { $category_id=$_GET['category_id']; setcookie('category_id',$category_id); $link.="&amp;category_id={$category_id}"; }elseif(isset($_COOKIE['category_id'])) { $_GET['category_id']=$_COOKIE['category_id']; $category_id=$_COOKIE['category_id']; $link.="&amp;category_id={$category_id}"; } </code></pre> <p>Now make your selection drop-down:</p> <pre><code>&lt;?php //Category Selection $options=Category_Selection($link); ?&gt; &lt;center&gt; &lt;SELECT NAME="category_id" ONCHANGE="location = this.options[this.selectedIndex].value;"&gt; &lt;OPTION VALUE=0&gt;&lt;/OPTION&gt; &lt;?php echo $options ?&gt; &lt;/SELECT&gt; &lt;/center&gt; </code></pre> <p>Repeat above for each required drop-down.</p> <p>Good luck...and, of course use MYSQLi to protect your site rather than the MYSQL shown above...</p>
 

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