I have a update form where I get variable data by typing : www.mysite.com/form.php?userid=1 That part is pretty easy, but when i want to process the data through a update page, something goes wrong. Can't see the problem so if anybody can, please help... FORM: <?php if (($_GET['uid']) && (is_numeric($_GET['uid']))) { $userid = $_GET['uid']; $dbhost = 'localhost'; $dbuser = 'username'; $dbpass = 'password'; $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql'); $dbname = 'database'; mysql_select_db($dbname); $query="SELECT * FROM tabel WHERE id=$userid"; $result=mysql_query($query) or die("Unable to find requested user"); $currUser = mysql_fetch_array($result); ?> <form name="form1" method="post" action="update.php"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td><input name="ID" type="hidden" id="ID" value="<? $_GET['uid'] ?>"> <input name="Name" type="text" id="Name" value="<? echo ("" . $currUser['Name'] . ""); ?>"></td> </tr> <tr> <td><input name="Email" type="text" id="Email" value="<? echo ("" . $currUser['Email'] . ""); ?>"></td> </tr> <tr> <td><input name="Homepage" type="text" id="Homepage" value="<? echo ("" . $currUser['Homepage'] . ""); ?>"></td> </tr> <tr> <td><input type="submit" name="Submit" value="Update"></td> </tr> </table> </form> <? } else { echo "No user specified"; } ?> Code (markup): ...and my update page: <?php $ID=$_POST['ID']; $Name=$_POST['Name']; $Email=$_POST['Email']; $Homepage=$_POST['Homepage']; $dbhost = 'localhost'; $dbuser = 'username'; $dbpass = 'password'; $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql'); $dbname = 'database'; mysql_select_db($dbname); $query = "UPDATE tabel SET Name = '$Name', Email = '$Email', Homepage = '$Homepage' WHERE ID='$userid'"; mysql_query($query); echo "<a href=\"\form.php?uid='$userid'\">Updated - Back</a>"; mysql_close(); ?> Code (markup): PLEASE HELP...
replace <td><input name="ID" type="hidden" id="ID" value="<? $_GET['uid'] ?>"> Code (markup): with <td><input name="ID" type="hidden" id="ID" value="<? echo $userid?>"> Code (markup): See if that helps
Yeah it looks like your script is passing the variables as POST variables instead of GET, change all of the $_GET to $_POST and that SHOULD work, I am lazy and just use $_REQUEST. This will require your register_globals to be set to 'on' IIRC.