yeah i know i just realised this.
Im working on it now but im not getting very far :-(
how much do you want for your code
here is what i have already, but the three red error stars *** are being shown immediately.
PHP Code:
<? if(isset($_POST['submit'])){ $field1 = $_POST['title']; $field2 = $_POST['forename']; $field3 = $_POST['surname']; $field4 = $_POST['dob']; $field5 = $_POST['gender']; $field6 = $_POST['employment']; $field7 = $_POST['drivingLicence']; $field8 = $_POST['houseenumber']; $field9 = $_POST['street']; $field10 = $_POST['town']; $field11 = $_POST['county']; $field12 = $_POST['postcode']; $field13 = $_POST['telephone']; $field14 = $_POST['email']; $field15 = $_POST['facilityRequired']; } else { $field1 = ''; $field2 = ''; $field3 = ''; $field4 = ''; $field5 = ''; $field6 = ''; $field7 = ''; $field8 = ''; $field9 = ''; $field10 = ''; $field11 = ''; $field12 = ''; $field13 = ''; $field14 = ''; $field15 = ''; } ?> <form method="post" action=""> <table width="87%" height="407" border="0" align="center" cellpadding="0" cellspacing="0"> <tr class="text"> <td height="24"><p><strong>ABOUT YOU:</strong></p></td> <td></td> </tr> <tr class="text"> <td height="24"><p>Title</p></td> <td><select name="title" value="<? echo $field1; ?>"> <option value="Mr">Mr <option value="Mrs">Mrs <option value="Ms">Ms <option value="Dr">Dr </select></td> </tr> <tr class="text"> <td height="22"><p>Forename(s):</p></td> <td><input type="text" name="forename" value="<? echo $field2; ?>"></td> <td> <?php if ($_POST['forename'] == ''){ echo "<font color='red'> *** </font>"; } ?> </td> </tr> <tr class="text"> <td height="13"><p>Surname:</p></td> <td><input type="text" name="surname" size="30" value="<? echo $field3; ?>"></td> <td> <?php if ($_POST['surname'] == ''){ echo "<font color='red'> *** </font>"; } ?> </td> </tr> <tr class="text"> <td height="13"><p>Date of birth (DD/MM/YYYY): </p></td> <td><input type="text" name="dob" size="30" value="<? echo $field4; ?>"></td> <td> <?php if ($_POST['dob'] == ''){ echo "<font color='red'> *** </font>"; } ?> </td> </tr> <tr class="text"> <td height="13"><p>Gender:</p></td> <td><select name="gender" value="<? echo $field5; ?>"> <option value="Male">Male <option value="Female">Female </select></td> </tr> <tr class="text"> <td height="13"><p>Type of Employment:</p></td> <td><select name="employment" value="<? echo $field6; ?>"> <option value"Full-time">Working Full-time <option value="Part-time">Working Part-time <option value="Self-employed">Self-employed <option value="Retired">Retired <option value="Disability Benefit">Disability Benefits </select></td> </tr> <tr class="text"> <td height="13"><p>Full UK Driving Licence:</p></td> <td><select name="drivingLicence" value="<? echo $field7; ?>"> <option vlaue="Yes">Yes <option value="No">No </select></td> </tr> <tr class="text"> <td height="24"><p><strong>YOUR CONTACT INFORMATION:</strong></p></td> <td> </td> </tr> <tr class="text"> <td height="13"><p>House/Number:</p></td> <td><input type="text" name="houseNumber" size="30" value="<? echo $field8; ?>"></td> <td> <?php if ($_POST['houseNumber'] == ''){ echo "<font color='red'> *** </font>"; } ?> </td> </tr> <tr class="text"> <td height="13"><p>Street:</p></td> <td><input type="text" name="street" size="30" value="<? echo $field9; ?>"></td> <td> <?php if ($_POST['street'] == ''){ echo "<font color='red'> *** </font>"; } ?> </td> </tr> <tr class="text"> <td height="13"><p>Town/City:</p></td> <td><input type="text" name="town" size="30" value="<? echo $field10; ?>"></td> <td> <?php if ($_POST['town'] == ''){ echo "<font color='red'> *** </font>"; } ?> </td> </tr> <tr class="text"> <td height="13"><p>County:</p></td> <td><input type="text" name="county" size="30" value="<? echo $field11; ?>"></td> <td> <?php if ($_POST['county'] == ''){ echo "<font color='red'> *** </font>"; } ?> </td> </tr> <tr class="text"> <td height="13"><p>Postcode:</p></td> <td><input type="text" name="postcode" size="30" value="<? echo $field12; ?>"></td> <td> <?php if ($_POST['postcode'] == ''){ echo "<font color='red'> *** </font>"; } ?> </td> </tr> <tr class="text"> <td height="13"><p>Telephone Number:</p></td> <td><input type="text" name="telephone" size="30" value="<? echo $field13; ?>"></td> <td> <?php if ($_POST['telephone'] == ''){ echo "<font color='red'> *** </font>"; } ?> </td> </tr> <tr class="text"> <td height="13"><p>Email Address:</p></td> <td><input type="text" name="email" size="30" value="<? echo $field14; ?>"></td> <td> <?php //lowercase email $email = strtolower($email); if (!valid_email($email)) { echo "You have entered an invalid email address"; } ?> </td> </tr> <tr class="text"> <td height="23"><p><strong>WHAT YOU WANT FROM US: </strong></p></td> <td> </td> </tr> <tr class="text"> <td height="13"><p>Facility Required:</p></td> <td><select name="facilityRequired" value="<? echo $field15; ?>"> <option value="Hire Purchase">Hire Purchase <option "Lease">Lease <option "Contract Hire">Contract Hire <option "Secured loan">Secured loan <option "Personal loan">Personal loan <option "Refinancing">Refinancing </select></td> </tr> <tr> <td> </td> </tr> <tr> <td class="text"><strong>IMAGE VERIFICATION: </strong></td> </tr> <tr> <td valign=top><span class="text">Your Code Is:</span><br> <br> <?=printBotBlock("********", "*******")?></td> <td valign=top><span class="text"><b>Please type your code here:</b></span><br> <br> <input name="bb_codeword" size=40 maxlength=40 value=""> <br> <span class="text">Please note that the letters are case sensitive. </span><br> <font color=blue class="text">If the text is unclear, click on the image.</font></td> <td> <?php if (!validBotBlock()) { echo "The image verification was incorrect"; } ?> </td> </tr> <tr> <td> </td> </tr> <tr class="text"> <td> </td> <td><input type="submit" value="Submit" name="submit"> <input type="reset" value="Clear fields"></td> </tr> </table> </form>
I need something that does the following:
on submit, if the entry is invalid then display an error message or the three stars ***, otherwise the data is valid so enter it into the database.
how can i do this? anyone got any ideas?
Last edited by jpmad4it; 02-04-2006 at 09:36 AM..
|