I have a dropdown list at the bottom of my page. It's populating like it's supposed to but when I choose whatever option I want and click submit it doesn't repopulate the content on the page like I want it to.
I'm trying to have content of the page change with whatever option was chosen.
Here's the code I have thus far.
///// Data from Datdbase ////
$sql = "SELECT * FROM table WHERE title = 'title'";
$result = mysql_query($sql,$db) or die(mysql_error()."<br />SQL: $sql");
$img = array();
$title = array();
while($row = mysql_fetch_array($result)){
// process data
$title[] = $row['title'];
$img[] = $row['img'];
}
///// Data from database ////
$sql = "SELECT * FROM table WHERE st_title = 'st_title'";
$result = mysql_query($sql,$db) or die(mysql_error()."<br />SQL: $sql");
//$row = mysql_fetch_array($result);
$ch_id = array();
$ch_title = array();
$ch_content = array();
//do{
while($row = mysql_fetch_array($result)){
// process data
$ch_title[] = $row['ch_title'];
$ch_content[] = $row['ch_content'];
$ch_id[] = $row['ch_id'];
}//while($row = mysql_fetch_array($result));
for($i = 0; $i < count($ch_title); $i++){
?>
<h3><img src="images/<?php print $img[$i]; ?>" alt="<?php print $title[$i]; ?>" border="0"/></h3>
<fieldset>
<legend><?php print $ch_title[$i]; ?></legend>
<?php print $ch_content[$i]; ?>
</fieldset>
<form action="JS.php" method="get">
<select name="ch_id">
<option value="">Next</option>
<?php
for ($i=0; $i < count($ch_id); $i++){
print '<option value="'.$ch_id[$i].'">'.$ch_title[$i].'</option>';
}
?>
</select>
<input type="submit" value="next" />
</form>
Help would truly be great.
thanks