I have an internal search page that lets me search the entire database without worrying about authentication. This form in particular has only four fields and it searches the (ClientReferrals) table. The results are returned on a standard table that's set up with repeating regions. One of the fields in the (ClientReferrals) table is (AEid). This field shows up in the record set that is returned when searching the table.
Below the table, I have a button that allows me to call-up the record of the AE (as identified by the AEid) from another table (AEinput). To accomplish this, I simply put a hidden field and set the value to
Code: Select all
<?php echo $row_SearchResults['AEid']; ?>Code: Select all
<?php } while ($row_SearchResults = mysql_fetch_assoc($SearchResults)); ?>Here is the code for the page... I would really appreciate it if someone notices anything... I'm teaching myself as I go and every so often I hit a brick wall. The page on the test server is at http://www.wattproductions.com/test/client_search.php (this is the code below).
Some search criteria that will return results are (Zip=11377) or (Zip=34787). Then the button labeled "Pull AE Record" sends the data via URL Variable to (/test/client_search_result.php), but, as I said, it's not currently passing that variable.
Thanks so much...
Michael
Code: Select all
<?php require_once('Connections/AEinput.php'); ?>
<?php
$colname_SearchResults = "%";
if (isset($HTTP_POST_VARS['BusName'])) {
$colname_SearchResults = (get_magic_quotes_gpc()) ? $HTTP_POST_VARS['BusName'] : addslashes($HTTP_POST_VARS['BusName']);
}
$colname2_SearchResults = "%";
if (isset($HTTP_POST_VARS['Contact'])) {
$colname2_SearchResults = (get_magic_quotes_gpc()) ? $HTTP_POST_VARS['Contact'] : addslashes($HTTP_POST_VARS['Contact']);
}
$colname3_SearchResults = "%";
if (isset($HTTP_POST_VARS['Phone'])) {
$colname3_SearchResults = (get_magic_quotes_gpc()) ? $HTTP_POST_VARS['Phone'] : addslashes($HTTP_POST_VARS['Phone']);
}
$colname4_SearchResults = "%";
if (isset($HTTP_POST_VARS['Zip'])) {
$colname4_SearchResults = (get_magic_quotes_gpc()) ? $HTTP_POST_VARS['Zip'] : addslashes($HTTP_POST_VARS['Zip']);
}
mysql_select_db($database_AEinput, $AEinput);
$query_SearchResults = sprintf("SELECT * FROM ClientReferrals WHERE (BusName LIKE '%%%s%%') AND (Contact LIKE '%%%s%%') AND (Phone LIKE '%%%s%%') AND (Zip LIKE '%%%s%%')", $colname_SearchResults,$colname2_SearchResults,$colname3_SearchResults,$colname4_SearchResults);
$SearchResults = mysql_query($query_SearchResults, $AEinput) or die(mysql_error());
$row_SearchResults = mysql_fetch_assoc($SearchResults);
$totalRows_SearchResults = mysql_num_rows($SearchResults);
?>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<!--DWLayoutTable-->
<tr>
<td width="2330" height="27" valign="top"><form action="view_info_result.php" method="post" name="internalform" id="internalform">
<table width="992" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<!--DWLayoutTable-->
<tr>
<td width="992" height="37" valign="top" bgcolor="#000000"> <div align="center"><font color="#FFFFFF" size="+3" face="Geneva, Arial, Helvetica, sans-serif">Search
Results</font></div></td>
</tr>
</table>
<table border="2" cellpadding="2" cellspacing="1">
<tr>
<td>ID</td>
<td>Name</td>
<td>Industry</td>
<td>Contact</td>
<td>Email</td>
<td>Phone</td>
<td>Address1</td>
<td>Address2</td>
<td>City</td>
<td>ST</td>
<td>Zip</td>
<td>Billing</td>
<td>Referral</td>
<td>AE</td>
<td>ReferredOn</td>
</tr>
<?php do { ?>
<tr>
<td><?php echo $row_SearchResults['ClientID']; ?></td>
<td><?php echo $row_SearchResults['BusName']; ?></td>
<td><?php echo $row_SearchResults['Industry']; ?></td>
<td><?php echo $row_SearchResults['Contact']; ?></td>
<td><?php echo $row_SearchResults['Email']; ?></td>
<td><?php echo $row_SearchResults['Phone']; ?></td>
<td><?php echo $row_SearchResults['Address1']; ?></td>
<td><?php echo $row_SearchResults['Address2']; ?></td>
<td><?php echo $row_SearchResults['City']; ?></td>
<td><?php echo $row_SearchResults['State']; ?></td>
<td><?php echo $row_SearchResults['Zip']; ?></td>
<td><?php echo $row_SearchResults['Billing']; ?></td>
<td><?php echo $row_SearchResults['Referral']; ?></td>
<td><?php echo $row_SearchResults['AEid']; ?></td>
<td><?php echo $row_SearchResults['ReferredOn']; ?></td>
</tr>
<?php } while ($row_SearchResults = mysql_fetch_assoc($SearchResults)); ?>
</table>
<table width="2330" border="0" cellpadding="0" cellspacing="0">
<p>
<input name="AEid" type="hidden" id="AEid" value="<?php echo $row_SearchResults['AEid']; ?>">
<input type="submit" name="Submit" value="Pull AE Record">
<input name="textfield" type="text" value="<?php echo $row_SearchResults['AEid']; ?>">
</p>
</form></td>
</tr>
</body>
</html>
<?php
mysql_free_result($SearchResults);
?>