Forums
This topic is locked
Application form validation
Posted 16 May 2006 12:27:49
1
has voted
16 May 2006 12:27:49 Raquel Poh posted:
Apparently, I have created 2 forms: Enquiry & Application forms and i have no problems at all validating the enquiry form as well as posting back the data filled in the enquiry form to my email. However, i've tried using the same codes I've used for my enquiry form for my application form but it doesn't seem to work. When i used the following codes and when debug it, it read error because i used too many variables????
My application form contain lots of form fields and when i validate it in DWMX2004, it post as a problem too...
can someone tell me how can i validate this application form with so MANY FORM FIELDS as well as enabling the data keyed into this application form to be send to me?
Here is the php code that works well for my enquiry form but not my application form:
<?
// Post email field from form
$receipent=$_POST['email'];
$subject= "ATTENTION! Your Enquiry Form has been successfully sent ";
$content= "Thank you for sending the Enquiry Form to us! We will revert to you as soon as possible! Cheers~
Reagrds,
JA Travel Pte Ltd";
$headers= "Hello there!";
mail($receipent, $subject, $content, $headers);
//receive email
$name=$_REQUEST['name'];
$email = $_REQUEST['email'] ;
$message = $_REQUEST['message'] ;
$homeno=$_REQUEST['homenumber'] ;
$hpno=$_REQUEST['hpnumber'] ;
$dateofdept=$_REQUEST['dateofdept'] ;
$monthofdept=$_REQUEST['monthofdept'] ;
$yearofdept=$_REQUEST['yearofdept'] ;
$dateofreturn=$_REQUEST['dateofreturn'] ;
$monthofreturn=$_REQUEST['monthofreturn'] ;
$yearofreturn=$_REQUEST['yearofreturn'] ;
$nameoftravellers=$_REQUEST['nameoftravellers'] ;
$content= " Name:$name\n\n
Email:$email\n\n
Name of othertravellers:$nameof travellers\n\n
Home Number:$homeno\n\n
Hp Number:$hpno\n\n
Date of departure:$dateofdept-$monthofdept-$yearofdept\n\n
Date of return:$dateofreturn-$monthofreturn-$yearofreturn\n\n
Message:$message ";
mail( " ", "Feedback Form Results",$content, "From: $email" );
header( "Location:thankyou1.htm" );
?>
This is the the application form code:
<form name="application" method="post" action="application.php">
<div align="center">
<p><font color="#999999" size="5" face="Alaska">Application Form <strong><font color="#FF0000"><br>
<font size="1" face="Arial, Helvetica, sans-serif">*Note: You have to fill
in this form. If you do not have a Mobile/Home number put a "0"
in the field to indicate that you have none.</font></font></strong></font></p>
<table width="65%" height="737" border="0">
<tr>
<td height="733">
<table width="100%" border="0">
<tr bgcolor="#996600">
<td colspan="3"><font color="#FFFFFF" size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong>Insured</strong></font></td>
</tr>
<tr bgcolor="#FFFFCC">
<td width="18%"> <div align="left"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Name:
</font></div></td>
<td colspan="2"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<input name="name" type="text" id="name" size="50" maxlength="100">
</font></td>
</tr>
<tr bgcolor="#FFFFCC">
<td height="25"> <div align="left"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">NRIC:
</font></div></td>
<td height="25" colspan="2"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<input name="nric" type="text" id="nric2">
</font></td>
</tr>
<tr bgcolor="#FFFFCC">
<td><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Address:
</font></td>
<td colspan="2"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<input name="address" type="text" id="address2" size="80" maxlength="100">
</font></td>
</tr>
<tr bgcolor="#FFFFCC">
<td><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Date
of Birth:</font></td>
<td colspan="2"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<input name="dateofbirth" type="text" id="dateofbirth2" size="2" maxlength="2">
/
<input name="monthofbirth" type="text" id="monthofbirth2" size="2" maxlength="2">
/
<input name="yearofbirth" type="text" id="yearofbirth2" size="4" maxlength="4">
<font size="1">(dd/mm/yyyy)</font></font></td>
</tr>
<tr bgcolor="#FFFFCC">
<td><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Email:
</font></td>
<td colspan="2"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<input name="email" type="text" id="email2" size="30" maxlength="50">
</font></td>
</tr>
<tr>
<td height="24" bgcolor="#FFFFCC"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Tel
: </font><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
</font></td>
<td width="31%" bgcolor="#FFFFCC"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<input name="homeoffnumber" type="text" id="homeoffnumber4" size="10" maxlength="10">
(Home /Office) </font></td>
<td width="51%" bgcolor="#FFFFCC"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<input name="hpnumber" type="text" id="hpnumber3" size="10" maxlength="10">
(Mobile)</font></td>
</tr>
</table>
<p><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Number
of Accompanying Children:
<input name="noofchildren" type="text" id="noofchildren" size="2" maxlength="2">
<br>
(For any Family Plan, children must be unmarried and unemployed and
must be no older than 18 years old of age or upon<br>
attainment of 23 years of age if studying full-time in a recognized
instituition of higher learning.Each child must be related to <br>
at least one insured adult.For Annual Plan, each child must be the
legal child of the insured adult(s).<br>
There is no limit to the number of accompanying children.)</font></p>
<table width="100%" border="0">
<tr bgcolor="#996600">
<td height="22" colspan="2"> <div align="center"><font face="Verdana, Arial, Helvetica, sans-serif"><strong><font color="#FFFFFF" size="2">Choice
of plan</font></strong></font></div></td>
<td colspan="3"> <div align="center"><font face="Verdana, Arial, Helvetica, sans-serif"><strong><font color="#FFFFFF" size="2">Choice
of Benefit </font></strong></font></div></td>
</tr>
<tr bgcolor="#FFFFCC">
<td width="20%"> <div align="center"><font face="Verdana, Arial, Helvetica, sans-serif"><font size="2">
<input name="indvidual" type="checkbox" id="indvidual" value="checkbox">
Individual </font></font></div></td>
<td width="18%"> <div align="center"><font face="Verdana, Arial, Helvetica, sans-serif"><font size="2">
<input name="family" type="checkbox" id="family" value="checkbox">
Family</font></font></div></td>
<td width="20%"> <div align="center"><font face="Verdana, Arial, Helvetica, sans-serif"><font size="2">
<input name="premier" type="checkbox" id="premier" value="checkbox">
Premier</font></font></div></td>
<td width="22%"> <div align="center"><font face="Verdana, Arial, Helvetica, sans-serif"><font size="2">
<input name="superior" type="checkbox" id="superior" value="checkbox">
Superior</font></font></div></td>
<td width="20%"> <div align="center"><font face="Verdana, Arial, Helvetica, sans-serif">
<font size="2">
<input name="classic" type="checkbox" id="classic" value="checkbox">
Classic</font></font></div></td>
</tr>
</table>
<br>
<table width="100%" border="0">
<tr>
<td width="47%" bgcolor="#996600"><font color="#FFFFFF" size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong>Per-trip.
Maximum of up to 182 days per trip</strong></font></td>
</tr>
<tr>
<td height="96" bgcolor="#FFFFCC"> <font size="2" face="Verdana, Arial, Helvetica, sans-serif" onmouseover="MM_validateForm('name','','R','nric','','R','address','','R','dateofbirth','','RisNum','monthofbirth','','RisNum','yearofbirth','','RisNum','email','','RisEmail','homeoffnumber','','RisNum','hpnumber','','RisNum','noofchildren','','RisNum','lengthoftrip','','R','dateoddept','','RisNum','monthofdept','','RisNum','yearofdept','','RisNum','dateofreturn','','RisNum','monthofreturn','','RisNum','yearofreturn','','RisNum','effectivedate','','RisNum','monthofeffect','','RisNum','yearofeffect','','RisNum','expirydate','','RisNum','monthofexpiry','','RisNum','yearofexpiry','','RisNum');return document.MM_returnValue">
<input name="pertrip182days" type="checkbox" id="pertrip182days" value="checkbox">
Per trip <br>
<br>
Furthest Destination from Singapore:
<input name="destination" type="text" id="destination">
<br>
<br>
Date of Departure:
<input name="dateofdept" type="text" id="dateofdept" size="2" maxlength="2">
/
<input name="monthofdept" type="text" id="monthofdept" size="2" maxlength="2">
/
<input name="yearofdept" type="text" id="yearofdept" size="4" maxlength="4">
<font size="1">(dd/mm/yyyy)</font><br>
<br>
Date of Return:
<input name="dateofreturn" type="text" id="dateofreturn" size="2" maxlength="2">
/
<input name="monthofreturn" type="text" id="monthofreturn" size="2" maxlength="2">
/
<input name="yearofreturn" type="text" id="yearofreturn" size="4" maxlength="4">
<font size="1">(dd/mm/yyyy)</font><br>
</font></td>
</tr>
</table>
<br>
<table width="100%" border="0">
<tr>
<td bgcolor="#996600"><strong><font color="#FFFFFF" size="2" face="Verdana, Arial, Helvetica, sans-serif">Annual.
Maximum of up to 90 days per trip</font></strong></td>
</tr>
<tr>
<td height="165" bgcolor="#FFFFCC"> <p> <font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<input name="annual" type="checkbox" id="annual" value="checkbox">
Annual</font></p>
<p><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Effective
Date:
<input name="effectivedate" type="text" id="effectivedate" size="2" maxlength="2">
/
<input name="monthofeffect" type="text" id="monthofeffect" size="2" maxlength="2">
/
<input name="yearofeffect" type="text" id="yearofeffect" size="4" maxlength="4">
<font size="1"> (dd/mm/yyyy) </font></font></p>
<p><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Expiry
Date:
<input name="expirydate" type="text" id="expirydate" size="2" maxlength="2">
/
<input name="monthofexpiry" type="text" id="monthofexpiry" size="2" maxlength="2">
/
<input name="yearofexpiry" type="text" id="yearofexpiry" size="4" maxlength="4">
<font size="1">(dd/mm/yyyy)</font></font></p>
<p align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><font size="1"><br>
</font><font size="1" onmouseover="MM_validateForm('name','','R','nric','','R','address','','R','dateofbirth','','RisNum','monthofbirth','','RisNum','yearofbirth','','RisNum','email','','RisEmail','homeoffnumber','','RisNum','hpnumber','','RisNum','noofchildren','','RisNum','dateoddept','','RisNum','monthofdept','','RisNum','yearofdept','','RisNum','dateofreturn','','RisNum','monthofreturn','','RisNum','yearofreturn','','RisNum','effectivedate','','RisNum','monthofeffect','','RisNum','yearofeffect','','RisNum','expirydate','','RisNum','monthofexpiry','','RisNum','yearofexpiry','','RisNum');return document.MM_returnValue">
<input type="submit" name="Submit" value="Submit">
</font></font></p></td>
</tr>
</table>
</td>
</tr>
</table>
<p><font color="#999999" size="5" face="Alaska"> </font></p>
</div>
</form>
Replies
Replied 16 May 2006 14:09:38
16 May 2006 14:09:38 Roddy Dairion replied:
can you post the application.php page? And why r u using $_REQUEST instead of $_POST?
Replied 17 May 2006 05:44:45
17 May 2006 05:44:45 Raquel Poh replied:
My application.php is empty as for why it is $_REQUEST its because i read in some forums and just used that command and it works. What's wrong with that command/variable?? Hmm... Im a lost sould in PHP... please help me.. I use to use the same codes i have in the enquiry.php in my application.php but since the codes didn;t work in the application.php i left it all blank.
Replied 17 May 2006 08:59:54
17 May 2006 08:59:54 Raquel Poh replied:
Currently i tested the codes in the enquiry.php and it is not working eithr ={ WHAT IS HAPPENING???!!! The other time it worked out fine but now the codes wont enable the data filled in the enquiry form to be sent to me via email. I also changed the $_REQUEST to $_POST but it is not working!!! This time its really seriously....HEEEELLLPPP...
Replied 17 May 2006 11:27:29
17 May 2006 11:27:29 Roddy Dairion replied:
Send the specs of how you want it to work and what the page does etc.. I'll try and fix it for you.
Replied 18 May 2006 04:39:35
18 May 2006 04:39:35 Raquel Poh replied:
I need the whole thing to work like this:
-user fills in the application form but there must be validation ( I do have checkbox , dropdown list as well ) but somehow i need the vaildation to come out neatly because when i used the DWMX vaildation, it came out in a mess not only that, the pop up message for the users to fill in the blanks came up even before the users click submit
-They will be directed to a THANK YOU page after they fill in the form
-The data will then be sent to my email
* I dont wanna install some php software that does the validation because i need to learn something out of these raw codes
A MILLION AND A ZILLION THANKS TO YOU!!!
-user fills in the application form but there must be validation ( I do have checkbox , dropdown list as well ) but somehow i need the vaildation to come out neatly because when i used the DWMX vaildation, it came out in a mess not only that, the pop up message for the users to fill in the blanks came up even before the users click submit
-They will be directed to a THANK YOU page after they fill in the form
-The data will then be sent to my email
* I dont wanna install some php software that does the validation because i need to learn something out of these raw codes
A MILLION AND A ZILLION THANKS TO YOU!!!
Replied 12 May 2008 13:25:25
12 May 2008 13:25:25 Ginny Ong replied:
How do i encrypt the enquiry form ? Do you have any codes to share ?
my email -
my email -