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?

Recommended Answers

All 11 Replies

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.

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

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.

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." :)

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

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.

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

BTW the post name is "Amazing Contact Form With Validation And Security Image."

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.