Jump to content

Userlist with button to nextpage with $_Post variable


Ryflex

Recommended Posts

Hi Everyone,

 

I'm trying to make an userlist where I have a button (or better a picture with a hyperlink) which if I click it I will be forwarded to a new page where the user name is send as a $_Post variable.

The code below is what I have this far. In some way when I click the send button it always gives the last username in the table in the $_Post variable. Can anyone help me please.

 

Thnx Ryflex

<?php

    require_once('auth.php');
    require_once('config.php');

$global_dbh         = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD)
                      or die("Could not connect to database");
                      mysql_select_db(DB_DATABASE, $global_dbh)
                      or die("Could not select database");

$user_query			= "SELECT *
				   FROM members";
$user_result		= mysql_query($user_query);
?>
<form ID="gotoresource" NAME="gotoresource" METHOD="POST" ACTION="resource_compose.php"> 
<table width="500" border="1" align="center" cellpadding="2" cellspacing="0">
<tr>
<td><b>User</b></td>
<td><b>Resource</b></td>
</tr>
<?php
while($row = mysql_fetch_assoc($user_result))
{
echo "<tr>";
echo "<td>"; 
echo $row['login'];
$user				= $row['login'];
?> 
<input name="User" type="hidden" maxlength="15" id="user" value="<?php echo $user; ?>"/>
</td>
<td>
<input type="submit" name="Submit" value="Send" />
</td>
    <?php
echo "</tr>";
}


?>
<html>
<head>
<title>Userlist</title>
<link href="loginmodule.css" rel="stylesheet" type="text/css" />
</head>
<body>

</body>

</html>

Link to comment
Share on other sites

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.