Page 1 of 1

want to input errors inside the form like in hotmail

Posted: Thu Apr 15, 2004 3:56 pm
by bugthefixer
i hav made an html form and i hav pplied constraints through regular expresions. right now wat happens is when i submit form, if there is wrong input then it shows it in next page..now wat i want is like in hotmail after submitting form..same form comes again with correct inputs already selected and those which hav some wrong input has some red star with it..
anybody can tell me how kan i do it

Posted: Thu Apr 15, 2004 4:08 pm
by Slippy
Just post to the same form as the original instead of redirecting(posting) to a different page.

You can check for the posted data and handle it as you see fit.

Code: Select all

<!-- FORM.PHP -->
<?php
if ($submit)&#123; echo "You submitted $var"; &#125;
?>

<form action="form.php" method="post">
<input type="text" name="var">
<input type="submit" name="submit" value="submit">
</form>