0

I need to create a form validation system where the user will be returned to the form with the valid data still in the form and the bad data barked for correction.

Can anyone point me to a good tutorial for that sort of thing?

6
Contributors
11
Replies
12
Views
7 Years
Discussion Span
Last Post by silviud
0

Here's one way to do it:

<?php
if($_POST) {

   // create short variable names
   $name = htmlentities(trim($_POST['name']));
   $email = htmlentities(trim($_POST['email']));

   // process form
} else {

   // create short variable names
   // they should have the same names as the ones created above
   $name = NULL;
   $email = NULL;
}

// begin page 
?>
<html>
<head></head>
<body>
<form ...>
   <input type="text" name="name" id="name" value="<?=$name?>" />
   <input type="text" name="name" id="name" value="<?=$email?>" />
</form>
</body>
</html>

Hope that helps!
- EF

0

i guess he want validation system...means if u typed wrong E-mail for ex. the page reload and make the E-Mail word with Red to type it agine.

0

Yes, but there are plenty of PHP form validation tutorials out there, plus you already offered him your code. I was simply providing a method to solve his request that "the user will be returned to the form with the valid data still in the form." :)

0

ahaa...got it...
BTW the form i have do that :D.. i posted the full codes and attached the needed files...check the last posts

Edited by DarkBerzerk™: n/a

0

Check the contact form in my cv website>> anas-tawfeek.co.cc
and try to type fake email and fake security number...if u want something like this i will post the full code for u. and the files.

It looks like your form has just what I'm looking for.

Would be very grateful if you'd post the code.

Cheers.

0

Already Posted It :) the three files codes and the ttf file (that use in the security image)...dont copy all the codes and cr8 files...coz i already uploaded them all in the end

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.