Forum Moderators: coopster
this is the first blank form that a user enters the lead to:
<tr>
<td>Return Visit Date: </td>
<td><input name="last_visit" type="text" class="text" id="last_visit" size="20" /> (ex. YYYY-MM-DD)
</td>
</tr>
then when you want to modify the record, which you query base on the record ID number:
if ($rec_id = $_POST['rec_id']){
$display .= 'You have selected Record:' . $rec_id . '<br /><br />';
$result=mysql_query("SELECT * FROM registration_table WHERE rec_id=$rec_id");
$num=mysql_num_rows($result);
$i=0;
while ($i < $num) {
$nhm_associate=mysql_result($result,$i,"nhm_associate");
$lead_date=mysql_result($result,$i,"lead_date");
$last_visit=mysql_result($result,$i,"last_visit"); //...etc the rest of the fields...
Then the field is populated with the table value:
<tr>
<td>Return Visit Date: </td>
<td><input name="last_visit" type="text" class="text" id="last_visit" size="20" value="' . $last_visit . '"> (ex. YYYY-MM-DD)
</td>
</tr>
Then the modif.php form, where it gets resubmitted to the dbase..
if ($security_admin === true ¦¦ $security_agent === true) {
$display = '';
$rec_id=$_POST['rec_id'];
if ($rec_id == "") {
$display .= 'No record ID identifier';
}
else{
$nhm_associate = $_POST['nhm_associate'];
$lead_date = $_POST['lead_date'];
$last_visit = $_POST['last_visit']; //..etc the rest of the fields...
then the UPDATE statement:
$sql=("UPDATE registration_table SET nhm_associate='$nhm_associate',lead_date='$lead_date',last_visit='$last_visit',//the rest of the fields...
Not sure if this page helps:
[dev.mysql.com...]
Illegal DATETIME, DATE, or TIMESTAMP values are converted to the “zero” value of the appropriate type ('0000-00-00 00:00:00', '0000-00-00', or 00000000000000).
dc