Forum Moderators: coopster
You can view brief information about the client with a hidden div tag, and you can also modify the record by clicking the link. That modify page then pulls all the data to the original registration form for modification and UPDATE (ing) of the record.
Although not a great idea, how can also make a DELETE link, so if they have duplicate records they can just delete them?
function leadstablenotspecified_display_addon() {
$security_admin = login::loginCheck('Admin', true);
$security_agent = login::loginCheck('Agent', true);
if ($security_admin === true ¦¦ $security_agent === true) {
global $config, $conn, $jscript;
require_once($config['basepath'] . '/include/misc.inc.php');
$misc = new misc();
$jscript.='<script type="text/javascript" src="'.$config['baseurl'].'/addons/leadstable/hiddendiv.js"></script>'."\r\n";
$display = '<table width="800">
<tr>
<td align="center" ><a href="index.php?action=addon_calendar_display"><img src="../../template/newhomemarket/images/calendaricon.jpg" width="25" height="25"><br />Calendar</a></td>
<td align="center"><a href="index.php?action=addon_leadstable_display26"><img src="http://www.example.com/images/contactcard_icon.jpg" width="25" height="25"><br />Contacts</a></td>
<td align="center"><a href="index.php?action=addon_builderreport_welcome"><img src="http://www.example.com/images/weekly_builder_icon.gif" width="25" height="25"><br />Builder Report</a></td
<td align="center"><a href="index.php?action=addon_leadstable_display25"><img src="http://www.example.com/images/registration_icon.png" width="25" height="25"><br />Registration</a></td>
</tr>
</table><br />';
// SELECT A COLUMN NAME FROM A TABLE:
$sql = 'SELECT * from registration_table WHERE nhm_associate="Not Specified" ORDER BY lname';
// EXECUTE
$recordSet = $conn->Execute($sql);
// CHECK IF ERROR
if ($recordSet === false) {
$misc->log_error($sql);
}
// KEEP READING TILL THE END
while (!$recordSet->EOF) {
// ASSOCIATE THE FIELD VALUE WITH A VARIABLE
$reg_id = $misc->make_db_unsafe ($recordSet->fields['rec_id']);
$reg_leaddate = $misc->make_db_unsafe ($recordSet->fields['lead_date']);
$reg_lastvisit = $misc->make_db_unsafe ($recordSet->fields['last_visit']);
$reg_assoc = $misc->make_db_unsafe ($recordSet->fields['nhm_associate']);
$reg_fname = $misc->make_db_unsafe ($recordSet->fields['fname']);
$reg_lname = $misc->make_db_unsafe ($recordSet->fields['lname']);
$reg_home_phone = $misc->make_db_unsafe ($recordSet->fields['home_phone']);
$reg_cell_phone = $misc->make_db_unsafe ($recordSet->fields['cell_phone']);
$reg_email = $misc->make_db_unsafe ($recordSet->fields['email']);
$reg_remarks = $misc->make_db_unsafe ($recordSet->fields['remarks']);
// PREPARE TO PRINT
$display .= '<br /><table style="width:100%; height:40px; background-image:url(http://www.example.com/images/contact_tab.gif); background-position:left; background-repeat:no-repeat; border-bottom: 3px solid #987F47;">
<tr>
<td style="width:200px; text-align:center;"> <a href="javascript:;" onclick="toggleDiv(' . $reg_id . ');">' . $reg_fname . ' ' . $reg_lname . '</a></td>
<td style="text-align:right;"><a href="index.php?action=addon_leadstable_display28&rec_id=' . $reg_id . '">Modify Record# ' . $reg_id . '</a></td>
</tr>
</table>';
$display .= '<div id="' . $reg_id . '" style="display: none;">
<table style="width:100%; background-color:#E1DEC6;" cellpadding="3" cellspacing="3">
<tr>
<td style="width:200px;">Name(s):</td>
<td>' . $reg_fname . ' ' . $reg_lname .'</td>
</tr>
<tr>
<td>Home Phone: </td>
<td>' . $reg_home_phone . '</td>
</tr>
<tr>
<td>Mobile Phone: </td>
<td>' . $reg_cell_phone . '</td>
</tr>
<tr>
<td>E-Mail:</td>
<td>' . $reg_email . '</td>
</tr>
<tr>
<td>Last Visit Date: </td>
<td>' . $reg_lastvisit . '</td>
</tr>
<tr>
<td>Lead Capture Date:</td>
<td>' . $reg_leaddate . '</td>
</tr>
<tr>
<td>Personal Remarks: </td>
<td>' . $reg_remarks .'</td>
</tr>
</table></div>';
// GO GET THE NEXT ONE
$recordSet->MoveNext();
}
} else {
// DISPLAY A WARNING TO THE PAGE AS ADMIN/AGENT IS NOT LOGGED
$display .= 'YOU ARE NOT AUTHORIZED TO VIEW THIS PAGE. PLEASE GO TO THE BOTTOM OF THE PAGE AND LOG IN!';
$recordSet->MoveNext();
}
return $display;
}
[edited by: eelixduppy at 6:09 pm (utc) on Nov. 27, 2007]
[edit reason] exemplified urls [/edit]
Another option is to add a "deleted" field to registration_table - only show records that have this set to "n" (or 0 or whatever) and when the user deletes a field, set it to "y" (or 1) via an update query. Then you can later "recover" the record if needed.