I found a little script form helgbut i have a problem:
when i hit submit nothing hapens.. i get redirected to the previos page..
Can someone help me with this problem? Here's the code:
tnx
btw im sure my database is correct
Code:<HTML> <HEAD> <TITLE>Update user</TITLE> </HEAD> <BODY> <? //include ("login.php"); include ("include/db.php"); $server = "$host"; $mysql_user = "$user"; $mysql_password = "$pass"; $database = "$db"; $userid = $_GET['userid']; // assuming you're sending the userid in the adress. Like: updateuser.php?id=23 // Connecting to mysql $link = mysql_connect($server, $mysql_user, $mysql_password) or die("Could not connect to mysql!<br />mysql error: " . mysql_error()); // Selecting databse mysql_select_db ($database, $link) or die("Could not select db!<br />mysql error: " . mysql_error()); // The query. You need to change this to reflect your tablename and columnames. $sql = "SELECT userid, password, webspace, userlevel FROM user WHERE userid=$userid"; //Retrieving data from database $result = mysql_query($sql) or die ("Invalid query!<br />mysql error: " . mysql_error()); if(empty($result)) { echo "Didn't find any user with that userid!"; } elseif(mysql_num_rows($result)>1) { echo "Duplicate users with that userid!"; } else { // Userlevels $levels = array(1=>'Basic', 'Normal', 'Extra', 'Reseller', 'Admin'); // Printing out the form echo "<form method=\"post\" action=\"updateuser.php?userid=test\">\n"; echo "<table>\n"; // Fetching the result into an associative array $row = mysql_fetch_array($result); echo "<tr><td>username</td><td>$userid</td></tr>\n"; echo "<tr><td>password</td><td><input type=\"text\" name=\"password\" value=\"" . $row['password'] . "\"></td></tr>\n"; echo "<tr><td><select size=\"1\" name=\"D1\">\n"; foreach ($levels as $key => $value) { if ($key == $row['userlevel']) { echo "<option selected=\"selected\" value=\"$key\">$value</option>\n"; } else { echo "<option value=\"$key\">$value</option>\n"; } } echo "</td></tr>\n"; echo "<tr><td>\n<input type=\"submit\" name=\"update\" value=\"update\"></td></tr>\n\n"; echo "</form>\n"; } ?>


but i have a problem:

Bookmarks