peace be with you all, I am retrieving some values from database and displaying in a drop down list using ajax and php.After selecting a field from drop down list(i.e. one of $row['course_codes']) I want to send the primary key contained in $courseId to another file for further processing after clicling the submit button. I am getting the values in drop down as expected but i can not pass the id to another file. Here is my code used to retrieved data in drop down list.
<?php
$qd = $_GET['q'];
$q = mysql_real_escape_string($qd);
$branch = $_SESSION['session_branch'];
$_SESSION['sem'] = $q;
$query = "select *FROM course_details WHERE branch='" . $branch . "' AND sem = '" . $q . "'";
$run = mysql_query($query) or die($query."<br/><br/>".mysql_error());
$num = mysql_numrows($run);
?>
<select class="action" name='id'>
<option name="usn" value="" class="displayUsn">-- Select Course --</option>
<?php
while($row = mysql_fetch_assoc($run)){
$courseId = $row['course_id'];
echo "<option class='displayRec' value = 'addToTemp.php?id=$courseId'" . ">" . $row['course_codes'] . "</option>";
}
echo "</select>";
if($num > 0){
echo " ";
echo "<input type='button' onClick=\"window.location.href='addToTemp.php'\" value='Add' id='id'>";
}else{
echo "No courses available";
}
mysql_close($bd);
?>
in addToTemp.php i am trying to get the id as follows:
if(isset($_GET['id'])){
$getId = $_GET['id'];
}
but id does not contained any value. please help.