JDPerry Posted April 19, 2006 Share Posted April 19, 2006 I have set up two drop down boxes on a form and when I submit the form the values that are passed are the last values in the list, not the selected value. What is the proper code to pass the selected variables.[!--coloro:#FF6666--][span style=\"color:#FF6666\"][!--/coloro--]This is the selection[!--colorc--][/span][!--/colorc--]//Create a selection list for the UserInfo table echo "<select name = 'EmpNum'>\n";echo "<option value = '0'>Select a User\n";//Retreive data until all results collected from UserInfowhile($row = mysql_fetch_array($result)) {extract($row);echo "<option value = $EmpNum>$Fname $Lname\n";}echo "</select>\n";echo "<br></br>"; echo "</td>";[!--coloro:#FF6666--][span style=\"color:#FF6666\"][!--/coloro--]This is how I am trying to pass it[!--colorc--][/span][!--/colorc--]print ("<INPUT TYPE=\"hidden\" NAME=\"EmpNum\" VALUE=\"$EmpNum>$Fname $Lname\">\n");print ("<INPUT TYPE=\"hidden\" NAME=\"PeriodID\"VALUE=\"{$HTTP_POST_VARS['PeriodID']}\">\n"); echo "<tr>"; echo "<td><input type='submit' value='View Report'>"; echo "</td>";Any help would be greatly appreciated. Quote Link to comment Share on other sites More sharing options...
redarrow Posted April 19, 2006 Share Posted April 19, 2006 $_sessionsexample.session_start()$varablename=($_session["name"]);on the other page.session_start()echo $varablename;Hope this helpsor from directly the database[code]$db=mysql_connect("localhost","name",password");mysql_select_db("database",$db);$query="select * from fieldname";$result=mysql_query($query);while($record=mysql_fetch_assoc($result)) {while(list($title,$data)=each($record)) {echo"<br>'".$title."' : '".$data."'<br>";}echo"<br>";}[/code] Quote Link to comment Share on other sites More sharing options...
poirot Posted April 19, 2006 Share Posted April 19, 2006 readarrow, I think this isn't what he wants.Why did you add this:[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]print ("<INPUT TYPE=\"hidden\" NAME=\"EmpNum\" VALUE=\"$EmpNum>$Fname $Lname\">\n");[/quote]??This will overwrite the selected value with the last value retrieved by the query.Try to just remove it.Also, remeber that the select dropdown MUST be in the <form> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.