I am working on building a member update script.
What it is supposed to do:
It queries the DB for the current member data
Displays that date in the form for correction
Upon submission of form Cleans the input and checks for errors.
If errors, sends data back to re-display form
If NO errors, it goes to update the DB…
Seems simple enough, but I seem to be losing data.
I’m not allowing it to update the DB just yet, because I’m still in testing stage, and just displaying all fields on the monitor.
I have it echo the data immediately after the query, and it is all there as it should be
It then displays it in the form, and it is all there as it should be,
But when I hit the submit button, and it goes through the clean and check for errors,
If No errors:
it gets to where it would write to the DB, and I have it echo the data to the screen, and two fields are missing.
If I mismatch the emails to throw an error, it warns me of the error and I click the button to correct the error, which re-displays the form for correction, and the same two fields are missing.
I can’t see where they are going, but it leads me to believe that the issue is in this form. Does that make sense?
Here is the form: (rather long, but figured you would need to see the whole thing.
The fields that go missing on submit are the fname and the addr2 in both cases
<form name="update" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
<table align="center" width="100%">
<tr>
<td align="center" colspan="2"><h2>Member Info Update</h2></td>
</tr>
<tr>
<td align="right" valign="top">Username:</td>
<td>
<b><u><font color="#FF0000"><?echo $user;?></font></u></b>
<font size="2" color="#FF0000">You cannot change this field</font>
</td>
</tr>
<tr>
<td align="right">Email Address:</td>
<td><input name="email" value="<?echo($email)?>" size="30" maxlength="128" /></td>
</tr>
<tr>
<td align="right">Confirm Email:</td>
<td><input name="cemail" value="<?echo($cemail)?>" size="30" maxlength="128" /></td>
</tr>
<tr>
<td align="right">First Name:</td>
<td><input name="$fname" value="<?echo($fname)?>" size="30" maxlength="30" /></td>
</tr>
<tr>
<td align="right">Middle Name/Initial:</td>
<td><input name="mname" value="<?echo($mname)?>" size="30" maxlength="30" /></td>
</tr>
<tr>
<td align="right">Last Name:</td>
<td><input name="lname" value="<?echo($lname)?>" size="30" maxlength="30" /></td>
</tr>
<tr>
<td align="right">Address 1:</td>
<td><input name="addr1" value="<?echo($addr1)?>" size="30" maxlength="30" /></td>
</tr>
<tr>
<td align="right">Address 2:</td>
<td><input name="$addr2" value="<?echo($addr2)?>" size="30" maxlength="30" /></td>
</tr>
<tr>
<td align="right">City:</td>
<td><input name="city" value="<?echo($city)?>" size="20" maxlength="20" /></td>
</tr>
<tr>
<td align="right">State:</td>
<td><input name="state" value="<?echo($state)?>" size="2" maxlength="2" /></td>
</tr>
<tr>
<td align="right">Zip Code:</td>
<td><input name="zip" value="<?echo($zip)?>" size="10" maxlength="10" /></td>
</tr>
<tr>
<td align="right">Telephone:</td>
<td><input name="phone" value="<?echo($phone)?>" size="14" maxlength="14" /></td>
</tr>
<tr>
<td align="center" colspan="2">Select the information you would like displayed on your website</td>
</tr>
<tr>
<td align="right">First Name</td>
<td>
<?$first_yes='unchecked'; $first_no='unchecked';
if ($disp_sel[1]=='1'){$first_yes='checked';}elseif($disp_sel[1]!='1'){$first_no='checked';}?>
<input type="radio" name="first" value="1"<?echo $first_yes?>>YES<br />
<input type="radio" name="first" value="0"<?echo $first_no?>>NO
</td>
</tr>
<tr>
<td align="right">Middle Name</td>
<td>
<?$mid_yes='unchecked'; $mid_no='unchecked';
if ($disp_sel[2]=='1'){$mid_yes='checked';}elseif($disp_sel[2]!='1'){$mid_no='checked';}?>
<input type="radio" name="mid" value="1"<?echo $mid_yes?>>YES<br />
<input type="radio" name="mid" value="0"<?echo $mid_no?>>NO
</td>
</tr>
<tr>
<td align="right">Last Name</td>
<td>
<?$last_yes='unchecked'; $last_no='unchecked';
if ($disp_sel[3]=='1'){$last_yes='checked';}elseif($disp_sel[3]!='1'){$last_no='checked';}?>
<input type="radio" name="last" value="1"<?echo $last_yes?>>YES<br />
<input type="radio" name="last" value="0"<?echo $last_no?>>NO
</td>
</tr>
<tr>
<td align="right">Telephone</td>
<td>
<?$tele_yes='unchecked'; $tele_no='unchecked';
if ($disp_sel[4]=='1'){$tele_yes='checked';}elseif($disp_sel[4]!='1'){$tele_no='checked';}?>
<input type="radio" name="tele" value="1"<?echo $tele_yes?>>YES<br />
<input type="radio" name="tele" value="0"<?echo $tele_no?>>NO
</td>
</tr>
<input type="hidden" name="subbed" value="y" />
<input type="hidden" name="orig_email" value="<?echo $orig_email;?>">
<tr>
<td align="right"> </td>
<td align="left"><input type="submit" name="update" value="Update Record" /></td>
</tr>
</table>
</form>
Any suggestions or insight would be greatly appreciated.
Thanks
Doug