I am currently building the user management section of my site, and I am at the editing users stage. I have a popup which takes the id of a user from MySQL database and populates textfields with their info. I then want the user to be able to alter these textfields and send the new values to the database. Sounds simple enough but....
I can get the popup to pass the id number, but not the altered text from the txt fields.
The script sending the data is below...
<?php
if (mysqli_connect_errno())
{
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
else
{
$id = $_GET["i"];
$mysqli = mysqli_connect("localhost","user","pass","opp_group");
$getDetails_sql = "SELECT * FROM cms_users where id='".$id."'";
$getDetails_res = mysqli_query($mysqli, $getDetails_sql)or die(mysqli_error());
if ($getDetails_res)
{
$row = mysqli_fetch_assoc($getDetails_res);
$f = $row['firstname'];
$s = $row['surname'];
$u = $row['username'];
$p = $row['password'];
}
else
{
printf("Could not retreive records: %s\n", mysqli_error($mysqli));
}
mysqli_close($mysqli);
}
echo "<h2>".$f." ".$s."</h2>";
?> <form method="post" action="user.php"> <?php
echo "
<table>
<tr><td>First Name: </td><td><input type=\"text\" name=\"firstname\" size=\"20\" value=\"".$f."\" /></tr>
<tr><td>Surname: </td><td><input type=\"text\" name=\"surname\" size=\"20\" value=\"".$s."\" /></tr>
<tr><td>Username: </td><td><input type=\"text\" name=\"username\" size=\"20\" value=\"".$u."\" /></tr>
<tr><td>New Password: </td><td><input type=\"text\" name=\"newpassword\" size=\"20\" value=\"Enter New Password\" /></tr>
<tr><td>Re-enter Password: </td><td><input type=\"text\" name=\"confirmpassword\" size=\"20\" value=\"Confirm New Password\" /></tr>
</table></form>
<br/><br/>
";
$new_f = $_POST['firstname'];
$new_s = $_POST['surname'];
$new_u = $_POST['username'];
$new_p = $_POST['newpassword'];
$conf_p = $_POST['confirmpassword'];
echo"<table>
<tr>
<td><input type=\"submit\" name=\"update\" value=\"Update User\" onclick=\"javascript:eventWindow('cms/updateuser.php?i=".$id."&f=".$new_f."');\"></td>
<td><input type=\"button\" name=\"delete\" value=\"Delete\" onclick=\"javascript:eventWindow('cms/deletevalidation.php?i=".$id."');\"></td>
</tr>
</table>";
?>
and this is the code receving the data.
Code: [Select]<php
$id = $GET["i"];
$f = $GET["f"];
echo $id;
echo $f;
?>at the moment I'm just trying to echo the variables that are being passed to the new page, to make sure that they are being populated. Any help please?