Jump to content

select


kendris

Recommended Posts

 

<html>


<?php include "overallheader.php" ?>
<div id ='container'>


<div id ='content'>


<div id='navBar'>
<?php include "navbar.php"?>
</div>
<div id='userinfo'>




<?php








session_start();








if (isset($_SESSION['username']))
{


$con = mysql_connect("localhost","root","");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }


mysql_select_db("login", $con);








mysql_close($con);
}
else
die("You must be logged in <a href='index.php'>Back</a>");








?>












<?php $con = mysql_connect("localhost","root","");
if (!$con)
 {
 die('Could not connect: ' . mysql_error());
 }
mysql_select_db("login", $con);
$result=mysql_query('SELECT eventname FROM event');
$result = mysql_query("SELECT * FROM event");
 ?>






</div>






<select name="listbox" size="5" onchange>
<?php


$tester=mysql_query('SELECT eventname FROM event ORDER BY eventname ASC');
while($row = mysql_fetch_array($tester))
  {
  echo "<option>" . $row['eventname'] . "</option>"  ;


  }
  ?>




</select>
<select name="price" size="5">




</select>
<select name="price" size="5">
 <?php


$location=mysql_query('SELECT location FROM event');
while($row = mysql_fetch_array($location))
  {
  echo "<option>" . $row['location'] . "</option>"  ;


  }
  ?>
</div>
</div>










</html>
 

Basically I'm looking for a way to make this dynamic, so if an option from the first select it will display options in a second table but for each select it will generate the correct listings.

Link to comment
https://forums.phpfreaks.com/topic/276151-select/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.