Jump to content

Recommended Posts

Ok I am pulling info from a db and creating a drop down list.

 

The drop down lists the name of the person. What I want to do is have this pull the id number as a hidden value and post the name and id to the next page.

 

<html>
<head><title></title></head>
<body>
<?php
include("misc.inc");
//8
$conn = mysql_connect($msql_server, $msql_user, $msql_password) or die ("Unable to Connect");

mysql_select_db($msql_db, $conn) or die ("Unable to Connect to DB");
$query = "SELECT * FROM members";

$result = mysql_query($query) or die ("Couldn't execute query.");
?>
<form action='addchar.php' method='POST'>

<table border="0">
<tr>
<td align="right">
<b>Players Name:</b>
</td>
<td>

<?php
echo "<select name='Players Name'>\n";
  while ($row = mysql_fetch_array($result))
  {
     extract($row);
    echo "<option value='$id $firstname $lastname'>$firstname $lastname\n";
  }  
echo "</select>\n";
?>
</td>
</tr>
<tr>
<td align="right">
<p>
<input type="hidden" name="id" value="$id">
<input type="submit" value="ADD">
<input type="reset" value="RESET">
</td>
</tr>
</table>
</form>

</body>
</html>

 

The problem I am having is the name and id will not post I am not sure how to pull the data or what code will pull it for me.

 

Any assistance would be appreciated.

I tried that and the issue I am having is when the variables come in from the DB request I can get them to the next page but what I want to do is get the id number to transfer over.

 

I have tried to combine the first and last name and send it just as name and that works. But when I try to use split so I can get the original value back (this is so I can pull info from the db again) it just won't work.

 

any help on figuring out how to get the id to transfer over would help out. :)

Have you tried storing the data in a session, then calling it on the next page?

 

Im not an expert, but I made a login a while back and I needed the data to not only go to the next page, but to go to three other pages, and I just stored it in a session, and called it when I needed it. Cookies might help too, but read up on it. Ill try and see if I can look up something regarding your problem I read a while back, Ill post here if I find it

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.