Jump to content

BMurtagh

Members
  • Posts

    42
  • Joined

  • Last visited

    Never

Everything posted by BMurtagh

  1. figured it out.. and it was a dumb mistake of not closing a <a href> to users.php with </a>.. now it doesn't revert back thanks for those who viewed the post, if i run into any other issues I'll add to the post
  2. Hello, I'm working on a project at work in which I'm converting our old excel spreadsheets into an online php+mysql web-based system. I have the add user functionality and delete user functionality working, however I'm stuck with editing a current user's database information. I'm populating an "edit user" form with information from the DB based off of the user's ID#: $query = "SELECT * FROM Users WHERE UserID = '$id'"; if (!$result) { echo "Could not successfully run query ($query) from DB: " . mysql_error(); exit; } while($row = mysql_fetch_array($result)) { echo "<fieldset style=\"width:100\" align=\"center\"><legend><font color=\"#FFFF00\">Edit User Information</font></legend><br />"; echo "<center><form id=\"edituser\" name=\"edituser\" method=\"post\" action="">"; echo "<font color=\"#FFFF00\">Name:</font> <input type=\"text\" name=\"name\" id=\"name\" value=\"".$row['Name']."\">" . "<br /><br /><br />"; echo "<font color=\"#FFFF00\">Username:</font> <input type=\"text\" name=\"username\" id=\"username\" value=\"".$row['Username']."\">" . "<br /><br />"; echo "<font color=\"#FFFF00\">Password:</font> <input type=\"text\" name=\"password\" id=\"password\" value=\"".$row['Password']."\">" . "<br /><br /><br /><br />"; echo "<font color=\"#FFFF00\">Department:</font> <input type=\"text\" name=\"dept\" id=\"dept\" value=\"".$row['Department']."\">" . "<br /><br />"; echo "<font color=\"#FFFF00\">Location:</font> <input type=\"text\" name=\"loc\" id=\"loc\" value=\"".$row['Location']."\">" . "<br /><br /><br /><br />"; echo "<font color=\"#FFFF00\">Printer 1:</font> <input type=\"text\" name=\"print1\" id=\"print1\" value=\"".$row['Printer1']."\">" . "<br /><br />"; echo "<font color=\"#FFFF00\">Printer 2:</font> <input type=\"text\" name=\"print2\" id=\"print2\" value=\"".$row['Printer2']."\">" . "<br /><br />"; echo "<br /><br /><br /></center>"; } The main issue I'm currently running into is once the data is pulled from the DB into the textboxes, I go to click on say Name or any of the fields and it basically takes me back to the previous page (users.php) which is just a SELECT * FROM Users and displays the information in a table. On the users.php page, I have 2 post actions, one for edit & one for del: while($row = mysql_fetch_array($result)) { $edit = "<form method=\"post\" action=\"edituser.php\"><input type=\"hidden\" name=\"UserID\" value=\"".$row['UserID'] ."\"><input type=\"image\" src=\"images/edit.png\" border=\"0\" alt=\"Edit Entry\"></form>"; $delete = "<form method=\"post\" action=\"deluser.php\"><input type=\"hidden\" name=\"UserID\" value=\"".$row['UserID'] ."\"><input type=\"image\" src=\"images/del.png\" border=\"0\" alt=\"Edit Entry\"></form>"; $id = $row['UserID']; echo "<p><tr>"; echo "<td>" . $row['UserID'] . "</td>" . "<td> " . $row['Name'] . "</td>" . "<td> " . $row['Username'] . "</td>" . "<td> " . $row['Password'] . "</td>" . "<td> " . $row['Location'] . "</td>" . "<td> " . $row['Department'] . "</td>" . "<td> " . $row['Printer1'] . "</td>" . "<td> " . $row['Printer2'] . "</td>" . "</td>" . "<td align=\"center\">" .$edit . "</td><td align=\"center\">" . $delete . "</td>"; echo "</tr>"; } echo "</table></center><br /><br /><p>"; I'm still confused/unsure why when after I populate the textboxes with the user's information I'm trying to edit it reverts back. If anyone has any suggestions, tips, or code snippets for a better way to do this, I'm interested. Thanks
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.