Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

getting information from a form 2

Status
Not open for further replies.

mrobinson

MIS
Oct 11, 2002
36
GB
i am having trouble getting information from one form to another form. I am trying to use a drop down menu with values from a database and once one is selected the value is used in an argument on the next from. I have tried printing the value to the screen in the next form but it comes up blank. I have other forms that exchange data so i think the problem is with my loop. The text fro which is below:

$display_block = "<h1>Select Course</h1>";

//get parts of records
$get_list = "select ctitle as display_name from course";
$get_list_res = mysql_query($get_list) or die(mysql_error());



if (mysql_num_rows($get_list_res) < 1) {
//no records
$display_block .= "<p><em>Sorry, no records to select!</em></p>";


} else {

$display_block .= "
<form method=\"post\" action=\"insert_attend2.php\">
<P><strong>Select a Course:</strong><br>
<select name=\"sel_id\">
<option value=\"\">-- Select One --</option>";

while ($recs = mysql_fetch_array($get_list_res)) {
$id = $recs['ctitle'];
$display_name = stripslashes($recs['display_name']);

$display_block .= "<option value=\"$id\">
$display_name</option>";
}

$display_block .= "
</select>
<p><input type=\"submit\" name=\"submit\" value=\"Select\"></p>
</FORM>";
}

Could anyon please tell me how i would call for the value selected in the next form as i have tried everything i can think of.

Many thanks


 
yes, i see where i was wrong there now and can get the value to pint to the screen on the next page but i'm still getting an sql error whenusing the line:

$get_list3 = "select mcode as display_name from module where ctitle =" .$_POST['sel_id'];

any ideas?

Thankyou both so much for your help
 
cancel that, i just got it to work.

Thanks again!!!!!!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top