Post userid to edit form
Posted: Fri Jan 28, 2005 7:07 pm
hi,
I have a form that shows all members .. within there I have a link that displays if user = admin .. to edit user level
I have created the form to show the existing data and also makes changes on submit ..
I can get it to display the user information when the link is clicked within the members page.
How is it done?
I thought something like:
But when the link is clicked no data is displayed in the browser as the url displays:
members.php looks like:
and the form that UPDATE USER LEVEL links to:
How should it be?
Cheers
I have a form that shows all members .. within there I have a link that displays if user = admin .. to edit user level
I have created the form to show the existing data and also makes changes on submit ..
I can get it to display the user information when the link is clicked within the members page.
How is it done?
I thought something like:
Code: Select all
<a href="../login/userlevel.php?userid=$userid">CHANGE USERS LEVEL</a>Code: Select all
http://www.bla.com/login/userlevel.php?userid=$useridCode: Select all
$sql = mysql_query("SELECT * FROM users");
while($row = mysql_fetch_array($sql)){
$userid = $rowї'$userid'];
$first = $rowї'first_name'];
$last_name = $rowї'last_name'];
<table width="100%" cellspacing="1" cellpadding="3">
<tr>
<td width="16%" class="txt"><strong>Name</strong></td>
<td class="txt"><?php echo $rowї'first_name']; ?> <?php echo $rowї'last_name']; ?>
</td>
</tr>
<tr>
<td colspan="2" class="txt"><div align="center"><a href="../login/userlevel.php?userid=$userid">UPDATE
USER LEVEL</a></div></td>
</tr>
</table>Code: Select all
<?
include("db.php");
$userid=$_GETї'userid'];
$sql="SELECT * FROM users WHERE userid='$userid'";
$result=mysql_query($sql);
$num=mysql_numrows($result);
mysql_close();
$i=0;
while ($i < $num) {
$first_name=mysql_result($result,$i,"first_name");
$last_name=mysql_result($result,$i,"last_name");
$user_name=mysql_result($result,$i,"user_name");
$user_level=mysql_result($result,$i,"user_level");
?>
<form action="../login/userlevelparse.php">
<input type="hidden" name="userid" value="<? echo "$userid"; ?>">
First Name: <? echo "$first_name"?><br>
Last Name: <? echo "$last_name"?><br>
User Name: <? echo "$user_name"?><br>
User Level: <input type="text" name="user_level" value="<? echo "$user_level"?>"><br>
<input type="Submit" value="Update">
</form>
<?
++$i;
}
?>Cheers