Hi I am trying to develop a php that uses javascript to store the selection of a radio button so i can use the value in a mysql select statement in order to dynamically created a dropdown box that corresponds with the value
my code does not work lol and it mostly looks like this:
<html>
<head>
<script type=”text/javascript>
function reload(sem)
{
var val=v;
self.location=’try.php?sem=’+ val;
}
</script>
</head>
<form name=”try” action=”tryexe.php” method=”POST”>
Choose Course Information
<BR>
Select Semester:
Fall<input type=”radio” name=”sem” value=”SP” onclick=”reload(this.value)”/>
Spring<input type=”radio” name=”sem” value=”F” onclick=”reload(this.value)”/>
<BR>
<select name=”course”>
<?php
mysql_connect(“localhost”, “root”, “****”) or die(mysql_error());
mysql_select_db(“****”) or die(mysql_error());
$s=$_GET[‘sem’];
$command=”Select Course_ID, Department, Number From COURSE Inner Join OFFERING ON COURSE.ID=OFFERING.Course_ID Where Semester=”$s”;”;
$result=mysql_query($command) or die(mysql_error());
while($row=mysql_fetch_array($result))
{
$id=$row[‘Course_ID’];
$d=$row[‘Department’];
$n=$row[‘Number’];
echo “<option value=”$id”> $d $n</option>”.”<BR>”;
}
mysql_close();
?>
</select>
</form>
</html>