hey everyone, i was wondering if anyone had any idea how i can redisplay my form after error checking has been finished with text that is possibly red and bold where the errors were.
Ex. someone puts in an invalid e-mail address so when the form is reloaded where it says "E-Mail Here:" that text will turn red.
i was thinking possibly storing the <span class> in an array so only certain errors will receive the errortext. here is some of my code.
that's just a small bit of the code but i think the point gets across... any help would be greatCode:<?php if(checkEmail($email) == FALSE) { $error[]="E-Mail Address"; $email = ""; $text[3] = "errortext"; } if(strlen($password) < 6) { $error[]="Password"; $text[5] = "errortext"; } if(!preg_match("/^([0-9])+/",$credit)){ $error[]="Credit Card Number"; $text[6] = "errortext"; } if(count($error) > 0) { echo "<b>The Following Errors Were Found, Please Re-Enter:</b><br/>"."</p>"; } else { require_once("formmail.php"); exit; } } ?> <style> .basictext { font-family: Arial, Helvetica, sans-serif; font-size: 14px; color:#000066; } .errortext { font-family: Arial, Helvetica, sans-serif; font-size: 14px; color:#C00000; font-weight: bold; } </style> <form method="post" action="ContactUs.php" name="form1" onSubmit="return checkCheckBox(this)"> <!-- form content --> <table class="qForm"> <tr> <td colspan="2" class="header">Contact Information:</td><td><font color="#FF0000"><span class="smalltype">*Required Field</font></span></td> </tr> <tr> <td class="left"><a><span class="<?print $text[1]?>">Company Name:</span></td> <td><input name="CompanyName" size="28" value="<?echo "$company"?>"></td> </tr> <tr> <td class="left"><span class="<?print $text[2]?>">Your Name:*</span></font></td> <td><input name="realname" size="28" value="<?echo "$name"?>"></td> </tr>



Reply With Quote
Bookmarks