Kindly assist me with situation below:
I am able to view my registered user. I have written a script to allow a particular user to be edited. This script pulls the user information from the database and displays it the same way as when the user was being registered. However, there are 2 drop-down areas and 1 radio button area. My problem is displaying the information in these areas so that if not edited, they remain the same. Otherwise I have to re-select these options and editing succeeds.
Code snippet is below:
[php]// Retrieve the user’s information:
$q = “SELECT user_name, first_name, last_name, email, position, dept, user_level FROM users WHERE user_id=$id”;
$r = mysqli_query ($dbc, $q);
//$dbc is my database connection parameters
if (mysqli_num_rows($r) == 1) { // Valid user ID, show the form.
// Get the user’s information:
$row = mysqli_fetch_array ($r, MYSQLI_NUM);
// Create the form:
echo ’
| User Name: | |
| Surname: | |
| Last Name: | |
| Email Address: | |
| Position: | Director Finance/Administration Manager Logistics/Procurement Manager Store Manager Fleet Manager IT Manager Receptionist |
| User Level | Admin <input type="radio" name="usrlevel" value="' . $row[6] . '" User |
Any help is appreciated.
Regards,