04-28-2008, 06:55 AM
|
#1 (permalink)
|
|
The Addict
Join Date: Jan 2008
Location: los angeles
Posts: 309
Thanks: 44
|
trying to post from one page to another and wont work
i have a table that displays the existing user names
Code:
<?php
include("config.php");
?>
<html>
<head>
<title>
</title>
<link href="stylesheets/style.css" type="text/css" rel="stylesheet" />
</head>
<body>
<form method="post" action="update_user.php">
<a href="adduser.php">Add User</a> <br>
<br>
<br>
<br>
<br>
<br>
<table>
<thead>
<tr>
<th> </th>
<th>Last Name</th>
<th>First Name</th>
<th>User Name</th>
<th>Level</th>
<th>Active</th>
</tr>
</thead>
<tbody>
<?php
#================================
# populate all users names
#================================
$user_sql = mysql_query("select * from tbl_users order by id");
while($row = mysql_fetch_assoc($user_sql)) {
echo "<tr>";
echo "<td><input type=\"radio\" name=\"rowid\" value=\"{$row['id']}\"></td>";
echo "<td>{$row['lname']}</td>";
echo "<td>{$row['fname']}</td>";
echo "<td>{$row['username']}</td>";
echo "<td>{$row['level']}</td>";
echo "<td>{$row['active']}</td>";
echo "</tr>";
}
?>
</tbody>
</table>
<input type="submit" name="btn_edit" value="Edit"> <input type="submit" name="btn_delete" value="Delete"><br>
<input type="hidden" name="txt_id" value="<?php echo $_POST['rowid']; ?>">
</form>
</body>
</html>
so when i make a selection and click on edit the next page doesnt show anything, how do request the post on the other page? i mean $_POST['value'] should do the trick but its not working what am i doing wrong??
here is the code for the other page
Code:
<?php
include("config.php");
$row_id = $_POST['rowid'];
$sql = mysql_query("select * from tbl_users where id = '$row_id'");
?>
<html>
<head>
<title>
</title>
<link href="stylesheets/style.css" type="text/css" rel="stylesheet" />
</head>
<body>
<p>Last Name: </p>
<?php
while($row = mysql_fetch_assoc($sql)) {
?>
<p><input type="text" name="txt_lname" value="<?php echo $row['lname']; ?>"></p>
<p>First Name</p>
<p><input type="text" name="txt_fname" value="<?php echo $row['lname']; ?>"></p>
<p>User Name</p>
<p><input type="text" name="txt_username" value="<?php echo $row['lname']; ?>"></p>
<p>Level: <select><option>will do later</option></select></p>
<p>Active: <input type="checkbox" name="chk_active" <?php if($row['active'] == TRUE) { echo "checked"; } else { } ?> ></p>
<?php } ?>
<p><input type="submit" name="submit" value="Save"></p>
</body>
</html>
__________________
no signature set
|
|
|
|