Paul,
Thanks for the reply. OK here is what I am trying to do.
I have a form that my case managers can use to input data. I also have a page where they can look at the information for all the clients entered, but I am trying to develop a page where the case managers can select a specific client and review the information they recorded on that specific client.
I can get the top part of the script to work, but I also want to post the information on that spefic client that I have below the ling. All of the data is in the same table, I just can't seem to get it posted.
Here is the file as I have modified it.
Thanks for your help.
John
<?php
// Set the page title and include the HTML header.
$page_title = 'Wireless Neighborhoods';
include_once ('include/header.html');
?>
<!-- Beginning of Content -->
<?php
//connect to database
$conn = mysql_connect("localhost", "root", "becky") or die(mysql_error());
mysql_select_db("testDB",$conn) or die(mysql_error());
if ($_POST[op] != "view") {
//haven't seen the selection form, so show it
$display_block = "<h1>Select an Entry</h1>";
//get parts of records
$get_list = "select id, concat_ws(', ', lname, fname) as display_name from client order by lname, fname";
$get_list_res = mysql_query($get_list) or die(mysql_error());
if (mysql_num_rows($get_list_res) < 1) {
//no records
$display_block .= "<p><em>Sorry, no records to select!</em></p>";
} else {
//has records, so get results and print in a form
$display_block .= "
<form method=\"post\" action=\"$_SERVER[PHP_SELF]\">
<P><strong>Select a Record to View:</strong><br>
<select name=\"sel_id\">
<option value=\"\">-- Select One --</option>";
while ($recs = mysql_fetch_array($get_list_res)) {
$id = $recs['id'];
$display_name = stripslashes($recs['display_name']);
$display_block .= "<option value=\"$id\">$display_name</option>";
}
$display_block .= "
</select>
<input type=\"hidden\" name=\"op\" value=\"view\">
<p><input type=\"submit\" name=\"submit\" value=\"View Selected Entry\"></p>
</FORM>";
}
} else if ($_POST[op] == "view") {
//check for required fields
if ($_POST[sel_id] == "") {
header("Location: selentry1.php");
exit;
}
//get master_info
$get_master = "select concat_ws(' ', fname, lname) as display_name from client where id = $_POST[sel_id]";
$get_master_res = mysql_query($get_master);
$display_name = stripslashes(mysql_result($get_master_res, 0,'display_name'));
$display_block = "<h1>Showing Record for $display_name</h1><br>
//-------------------------------------------------------
Student ID: $student_id<br>
Input Date: $input_date<br>
Name: $first $last<br>
Address: $address<br>
City: $city<br>
State: $state<br>
Zip Code: $zip<br>
Home Phone: $hphone<br>
Mobil Phone: $mphone<br>
Email Address: $email<br>
CTC organization: $ctcorg<br>
Case Manager: $cmanager <br>
Notes: $notes<br><hr><br>";
$display_block .= "<P align=center>
<a href=\"basicinfo_form2.php?master_id=$_POST[sel_id]\">add info</a> ...
<a href=\"$_SERVER[PHP_SELF]\">select another</a></p>";
}
?>
<HTML>
<HEAD>
<TITLE>My Records</TITLE>
</HEAD>
<BODY>
<?php echo $display_block; ?>
</BODY>
</HTML>
<!-- End of Content -->
<!-- Start of Footer -->
<?php
include_once ('include/footer.html');
?>