Hey guys, me again.
OK, I have this form that gets and populates the select boxes with the necessary info.
Now, what I would like to do is to take the id field of the select box and use that to do a select query on the relevant table. So when the user selects, for eg a person, and then hits the edit person button I would like a new page to open and a form to be filled with the person's details from the database. Then the user should be able to edit that info and submit any changes to the database.
Here is the code that populates the initial select boxes to choose what to edit.
<form class="semantic" method="post" action="">
<fieldset>
<ul>
<li>
<legend>View and/or Edit Person</legend>
<?php
$ops = '';
$sql_select = "select person_id, first_name, middle_name, last_name from `person` order by `last_name` asc ";
$retval_selectperson = mysql_query( $sql_select, $conn );
if(! $retval_selectperson ) { die('Could not select data: ' . mysql_error()); }
while($row = mysql_fetch_assoc($retval_selectperson))
{
$ops .= "<option value='{$row['person_id']}'>{$row['first_name']} {$row['middle_name']} {$row['last_name']}</option>";
}
?>
<div>
<label for="person_id">Select a Person</label>
<select name="person_id" id="person_id">
<option value="">--- Select a Person ---</option>
<?php echo $ops;?>
</select>
</div>
<div class="button-row">
<input name="edit" type="submit" id="edit_person" value="Edit Person">
</div>
</li>
So when the submit button is clicked, a new page opens and the record is displayed and then the editing of that record, if necessary, can take place and then if changed it can be updated to the database using an update query.
I need to know how to go to another page and actually do that.