Jump to content


Photo

Option Select


  • Please log in to reply
2 replies to this topic

#1 JDPerry

JDPerry
  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 19 April 2006 - 02:28 AM

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 UserInfo
while($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.

#2 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 19 April 2006 - 02:36 AM

$_sessions

example.

session_start()

$varablename=($_session["name"]);


on the other page.

session_start()
echo $varablename;

Hope this helps


or from directly the database

$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>";
}

Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#3 poirot

poirot
  • Members
  • PipPipPip
  • Advanced Member
  • 646 posts
  • LocationAustin, TX

Posted 19 April 2006 - 04:06 AM

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>
~ D Kuang




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users