Greetings everyone,
Well, with the help of some tutorials I have been able to get my membership sign up page working. The form will input the data into the database, there is some simple error checking that I have that works okay, but I had a question regarding preview and editing and would like to do the following:
1) Form page: When the user clicks on the submit button, I would like it to go to a "Preview" so they can check their submitted information.
a) If all information is correct: Click "Submit"
b) If some of the information is wrong: Click "Edit"
Then once entered form data is correct, they can then submit into the database. Cannot seem to find anything clear on how to do this.
2) Register.php: This page does all the checking and if any fields are left blank, it will report the error and take them back to the page. PROBLEM: I am using radio buttons since they can only select one type of option. However, if an error is returned, the previously selected radio button is not retained. How do I fix this?
3) Mail function in register.php: I send two emails: One to the submitter and one to our member coordinator. In order to clean up the code, can I simply move the message information (using the same format and variable calls) into include or a txt file to be called?
Thanks!
Here is the code taken from tutorials. If anyone has suggestions for cleaning up the code, please let me know. I followed this pattern since it made the most sense to me and that I could get to work:
Membership Form:
<form name="form1" method="post" action="register.php">
<table width="100%" border="0" cellpadding="4" cellspacing="0">
<tr>
<td width="24%" align="left" valign="top"><div align="right"><strong>First
Name:</strong></div></td>
<td width="76%"><input name="first_name" type="text" id="first_name" value="<? echo $first_name; ?>"></td>
</tr>
<tr>
<td align="left" valign="top"><div align="right"><strong>Last Name:</strong></div></td>
<td><input name="last_name" type="text" id="last_name" value="<? echo $last_name; ?>"></td>
</tr>
<tr>
<td align="left" valign="top"><div align="right"><strong>Email Address:</strong></div></td>
<td><input name="mem_email_addr" type="text" id="mem_email_addr" value="<? echo $mem_email_addr; ?>"></td>
</tr>
<tr>
<td align="left" valign="top"><div align="right"><strong>Alternate Email
Address:</strong></div></td>
<td><input name="mem_alt_email" type="text" id="mem_alt_email" value="<? echo $mem_alt_email; ?>"></td>
</tr>
<tr>
<td align="left" valign="top"><div align="right"><strong>Street Address:</strong></div></td>
<td><font face="Times New Roman, Times, serif">
<input name="mem_addr" type="text" id="mem_addr" size="40" maxlength="55" value="<? echo $mem_addr; ?>">
</font></td>
</tr>
<tr>
<td align="left" valign="top"><div align="right"><strong>City/Town/Village:</strong></div></td>
<td><font face="Times New Roman, Times, serif">
<input name="mem_city" type="text" id="mem_city" size="40" maxlength="40" value="<? echo $mem_city; ?>">
</font></td>
</tr>
<tr>
<td align="left" valign="top"><div align="right"><strong>State:</strong></div></td>
<td><font face="Times New Roman, Times, serif">
<input name="mem_state" type="text" id="mem_state" size="15" maxlength="25" value="<? echo $mem_state; ?>">
</font></td>
</tr>
<tr>
<td align="left" valign="top"><div align="right"><strong>Zip/Postal Code:</strong></div></td>
<td><font face="Times New Roman, Times, serif">
<input name="mem_zip" type="text" id="mem_zip" size="15" maxlength="15" value="<? echo $mem_zip; ?>">
</font></td>
</tr>
<tr>
<td align="left" valign="top"><div align="right"><strong>Country:</strong></div></td>
<td><font face="Times New Roman, Times, serif">
<input name="mem_country" type="text" id="mem_country" size="40" maxlength="45" value="<? echo $mem_country; ?>">
</font></td>
</tr>
<tr>
<td colspan="2"><font face="Times New Roman, Times, serif"><strong>Choose
your type of Membership:</strong></font></td>
</tr>
<tr>
<td colspan="2" valign="top"> <p> <strong><font face="Times New Roman, Times, serif">
<input name="mem_type" type="radio" id="mem_type" value="<? $mem_type=Individual; ?>">
Individual Member: </font><font color="#FF0000" face="Times New Roman, Times, serif">
<em>$15 [USA], $18 USD [Canada], $21 USD [Overseas]<br>
</em></font></strong><font face="Times New Roman, Times, serif">·
2 issues of the LGGS newsletter (equivalent to a 1 yr membership), Proteviai<br>
· Unlimited surname submissions to LGGS website. </font></p></td>
</tr>
<tr>
<td colspan="2" valign="top"><font face="Times New Roman, Times, serif"><strong><font face="Times New Roman, Times, serif">
<input name="mem_type" type="radio" id="mem_type" value="<? echo $mem_type=Bronze; ?>">
Bronze Member: </font><font color="#FF0000" face="Times New Roman, Times, serif">
<em>$25 USD<br>
</em></font></strong><font face="Times New Roman, Times, serif">·
Same as Individual Member plus; <br>
· Support of LGGS mission to assist Lithuanian Nationals with membership,
provide copies of newsletter to non-profit entities, and cover expenses.
</font></font></td>
</tr>
<tr>
<td colspan="2" valign="top"><font face="Times New Roman, Times, serif">
<input name="mem_type" type="radio" id="mem_type" value="<? echo $mem_type=Silver; ?>">
<strong>Silver<font face="Times New Roman, Times, serif"> Member: </font><font color="#FF0000" face="Times New Roman, Times, serif">
<em>$100 USD<br>
</em></font></strong><font face="Times New Roman, Times, serif">·
4 issues of the LGGS newsletter (equivalent to a 2 yr membership) <br>
· Publication of your name as a Silver Member in Proteviai and
on the LGGS website. </font></font></td>
</tr>
<tr>
<td colspan="2" valign="top"> <div align="left"><font face="Times New Roman, Times, serif">
<input name="mem_type" type="radio" id="mem_type" value="<? echo $mem_type=Gold; ?>">
<strong>Gold<font face="Times New Roman, Times, serif"> Member: </font><font color="#FF0000" face="Times New Roman, Times, serif">
<em>$300 USD<br>
</em></font></strong><font face="Times New Roman, Times, serif">·
Same as Silver Member plus;<br>
· Lifetime membership in Lithuanian Global Genealogy Society.
</font></font></div></td>
</tr>
<tr valign="top">
<td colspan="2"><font face="Times New Roman, Times, serif">
<input name="mem_type" type="radio" id="mem_type" value="<? echo $mem_type=Institutional; ?>">
<strong>Institutional<font face="Times New Roman, Times, serif"> Member:
</font><font color="#FF0000" face="Times New Roman, Times, serif"> <em>$15
USD<br>
</em></font></strong><font face="Times New Roman, Times, serif">·
Societies, Family Associations, Libraries, and other non-profit entities.<br>
· Name of Institution here:
<input name="Name_of_Institution" type="text" id="Name_of_Institution" size="50">
</font></font></td>
</tr>
<tr>
<td colspan="2" align="left" valign="top"><font face="Times New Roman, Times, serif">All
memberships include an annual directory of our members, which include
name, email, and address. This will allow members to find others in their
area for contact. If you wish to protect your privacy, you may choose
to have your address information withheld (select the "No" checkbox
on the membership form). In this case, only your name will be listed in
the directory.<br>
<br>
<em><strong>May we include your mailing address in the membership directory?</strong></em>
<input name="mem_directory" type="checkbox" id="mem_directory?" value="<? echo $mem_directory=Yes; ?>">
Yes
<input name="mem_directory" type="checkbox" id="mem_directory?" value="<? echo $mem_directory=No; ?>">
No</font></td>
</tr>
<tr>
<td align="left" valign="top">Desired Username</td>
<td><input name="username" type="text" id="username" value="<? echo $username; ?>"></td>
</tr>
<tr>
<td align="left" valign="top">Information about you:</td>
<td><textarea name="memo" id="memo"><? echo $memo; ?></textarea></td>
</tr>
<tr>
<td align="left" valign="top"> </td>
<td><input type="submit" name="Submit" value="Join Now!"></td>
</tr>
</table>
</form>
Thanks! Any tips or pointers would be appreciated.