Thanks greatly for the help and ideas from Cgraz, ahundiak, and Duey. I don't have it figured out quite yet. I will send the whole files. It is obvious, of course, just how new I am to this. I must confess that this is inherited code that I am attempting to rework and learn as I go. I had made the assumption that this was sound code because it worked. The MySQL data base ported from an "MS-Access" file was all in a single table and not even normalized to the first form. I've re-created a MySQL relational file with 7 tables. I believed that all I had to do was plug in the new table structure to the solid PHP code. I understand now that this PHP code is really rough. This is an actual prototype product that I'm wanting to use for RAD development with the end-users. I hope that I am not deceiving myself that I am learning alot!?!? Here is some of the pieces of the code that I think is relevant ( am hitting the 10000 character limit):
update.php
<?
if (!isset($valid_user))
{
header("Location: problem.php");
}
require("bookmark.php");
include("css.inc");
?>
<html>
<head>
<title>Inserting the data</title>
</head>
<body bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
<? do_html_header();
$result6 = mysql_query("select * from applicant_tbl,
blm_office,
curation_tbl,
permit_table,
staff_tbl,
status_tbl,
stips_tbl where SERIALNO='$SERIALNO'");
if (mysql_num_rows($result6) < 1)
{
echo "<p>The serial number you provided does not exist in the database.</p>";
display_user_menu();
do_html_footer();
exit;
}
else
{
list($applicant_tbl.appID1, --snip, snip---
$stips_tbl.Report1, $stips_tbl.Report_date1) = mysql_fetch_row($result6));
$results10 = mysql_query("select permitid from applicant_tbl,
blm_office,
curation_tbl,
permit_table,
staff_tbl,
status_tbl,
stips_tbl where SERIALNO='$SERIALNO'");
list($permitid) = mysql_fetch_row($results10);
?>
<form action="update_info.php" method=post>
<table width="600" cellspacing="0" cellpadding="5" border="1" bgcolor="#6699CC" align="center">
<tr>
<td nowrap>
<label for="SERIALNO"><b>Serial No.</b></label>
</td>
<td>
<input type="text" size="40" name="SERIALNO" id="SERIALNO" value="<? echo $SERIALNO1; ?>">
</td>
</tr>
<tr>
<td nowrap>
<label for="type"><b>Type</b></label>
</td>
<td>
<input type="text" size="40" name="permit_table.type" id="permit_table.type" value="<? echo $permit_table.type1; ?>">
</td>
</tr>
<tr>
<td nowrap>
<label for="issued"><b>Date Issued</b></label>
</td>
<td>
<input type="text" size="40" name="permit_table.issued" id="permit_table.issued" value="<? echo $permit_table.issued1; ?>">
</td>
</tr>
<tr>
<td nowrap>
<label for="fy"><b>FY</b></label>
</td>
<td>
<input type="text" size="40" name="permit_table.fy" id="permit_table.fy" value="<? echo $permit_table.fy1; ?>">
</td>
</tr>
<tr>
<td nowrap>
<label for="applicant_tbl.First_Name"><b>Applicant First Name</b></label>
</td>
--snip, snip---
<tr>
<td nowrap>
<label for="stips_tbl.Report_date"><b>Report Due Date</b></label>
</td>
<td nowrap>
<input type="text" size="40" name="stips_tbl.Report_date" id="stips_tbl.Report_date" value="<? echo $stips_tbl.Report_date1; ?>">
</tr>
<tr>
<td colspan="2" align="center" valign="center">
<input type="submit" value="Submit">
<input type="reset" value=" Clear ">
</td>
</tr>
</table>
<input type="hidden" name="username" value="<? echo $username; ?>" />
<input type="hidden" name="permitid" value="<? echo $permitid; ?>" />
</form>
<?
}
// give menu of options
display_user_menu();
do_html_footer();
?>
</body>
</html>
--bookmark.php----
<?
// We can include this file in all our files
// this way, every file will contain all our functions
require_once("config.php");
require_once("functions.php");
require_once("output.php");
?>
--config.php--
<?
$dbuser = 'dwmartin'; // Database username
$dbhost = '127.0.0.1'; // Database hostname
$dbpass = 'xxxxxxxxxx'; // Database password
$dbname = 'permit'; // Database name
$security_hash = "gfdhedgrgdffccgas45r45r43tsdgf"; // Change this string to something random
$prompt_for_delete = 1; // 0 = NO or 1 = YES
?>
--functions.php--
<?
function dbconnect()
{
// include("config.php");
/This below is the actual config.php file to replace the includethat is commented out above/
?>
<?
$dbuser = 'dwmartin'; // Database username
$dbhost = '127.0.0.1'; // Database hostname
$dbpass = 'xxxxxxx'; // Database password
$dbname = 'permit'; // Database name
$security_hash = "gfdhedgrgdffccgas45r45r43tsdgf"; // Change this string to something random
$prompt_for_delete = 1; // 0 = NO or 1 = YES
}
?>
/This above is the actual config.php file to replace the include that is commented out above/
// Create Connection
$connection = mysql_connect($dbhost, $dbuser, $dbpass);
}
// Test Connection
if (!$connection)
{
echo "Error: Could not connect to database. Please try again later.";
exit;
}
// Select Database
$db = mysql_select_db($dbname, $connection);
// Test Selection
if (!$db) {
echo "Couldn't select database!";
exit;
}
}
dbconnect();
function add_info($serial, $type, $issued, $fy, $activity, $applicant, $phone, $address, $city_state, $resp_person, $key_1, $key_2, $key_3, $key_4, $key_5, $start, $expiration, $denied, $repository, $rae, $rep_phone, $rep_address, $rep_city_state, $extention, $extended, $ext_expires, $authorized, $fo_1, $fo_2, $conditions, $reports, $report_date, $notified, $comments, $username)
{
$result5 = mysql_query("select firstname,lastname,date from users where username='$username'");
list($firstname,$lastname,$date) = mysql_fetch_row($result5);
$addinfo = mysql_query("insert into permit_table values ('', '$serial', '$type', '$issued', '$fy', '$activity', '$applicant', '$phone', '$address', '$city_state', '$resp_person', '$key_1', '$key_2', '$key_3', '$key_4', '$key_5', '$start', '$expiration', '$denied', '$repository', '$rae', '$rep_phone', '$rep_address', '$rep_city_state', '$extention', '$extended', '$ext_expires', '$authorized', '$fo_1', '$fo_2', '$conditions', '$reports', '$report_date', '$notified', '$comments')");
echo "<table align=\"center\" width=\"528\" border=\"3\">
<tr>
<td width=\"516\"><b>Message:</b> <b><font color=\"blue\">$firstname</font></b>, the information was entered successfully.</td>
</tr>
</table><br>";
}
function update_info($permitid, $serial, $type, $issued, $fy, $activity, $applicant, $phone, $address, $city_state, $resp_person, $key_1, $key_2, $key_3, $key_4, $key_5, $start, $expiration, $denied, $repository, $rae, $rep_phone, $rep_address, $rep_city_state, $extention, $extended, $ext_expires, $authorized, $fo_1, $fo_2, $conditions, $reports, $report_date, $notified, $comments, $username)
{
$updateinfo = mysql_query("update permit_table set serial='$serial', type='$type', issued='$issued', fy='$fy', activity='$activity', applicant='$applicant', phone='$phone', address='$address', city_state='$city_state', resp_person='$resp_person', key_1='$key_1', key_2='$key_2', key_3='$key_3', key_4='$key_4', key_5='$key_5', start='$start', expiration='$expiration', denied='$denied', repository='$repository', rae='$rae',
rep_phone='$rep_phone', rep_address='$rep_address', rep_city_state='$rep_city_state', extention='$extention', extended='$extended', ext_expires='$ext_expires', authorized='$authorized', fo_1='$fo_1', fo_2='$fo_2', conditions='$conditions', reports='$reports', report_date='$report_date', notified='$notified', comments='$comments' where permitid='$permitid'");
if ($updateinfo)
{
echo "<table width=\"528\" border=\"3\">
<tr>
<td width=\"516\"><b>Message:</b> \"<font color=\"red\">$applicant</font>\" Information with serial #\"<font color=\"#FF0000\">$serial</font>\" has been updated!</td>
</tr>
</table><br>";
return 1;
}
else
return 0;
}
function delete_user($username)
{
include("config.php");
if($prompt_for_delete)
{
echo "Are you sure you want to delete the user \"<font color=\"#FF0000\">$username</font>\"?<br />";
echo "<a href=\"admin.php?op=deleteuserconf&username=$username\">Yes</a> <a href=\"admin.php\">No</a>";
}
else
Again thanks for bearing with this newbie, wanabe PHP programmer. So far I've been impressed by the PHP capabilities, but even more impressed with the PHP community.
Dan Martin :rolleyes: