You are here: Re: server side form validation - update forms « PHP Language « IT news, forums, messages
Re: server side form validation - update forms

Posted by Erwin Moller on 09/21/07 13:33

Your Name Here wrote:
> Hi,
>
> Being new coding in phpI have a question concerning server side form
> validation.
>
> In a php script I check if a form is correctly filled in. Now I want that the
> page containing the forms is represented agian so that the user can fill in a
> correct value. The other forms that a correctly filled in should be showed
> agian.
>
> On the moment when a user fills in a wrong value they get a different page
> with a message...some that isn't tha usable. I want to represent the orginal
> form again.
>
> Thanks

Hi,

Simply put in the values in the form again.

A simple way to convey the idea:

From receiving PHP-script:

$url="http://www.example.com/myForm.php";
// do formchecking here
if ((isset($_POST["title"])) && (strlen($_POST["title"]) < 10)){
// title too short!
$url .= "?oldtitle=".urlencode($_POST["title"]);
header("Location: $url");
exit;
}

Then from the form-page:
<form action=".." Method="POST">
Title:
<input type="text" name="title" value="<?php echo
((isset($_GET["title"]))? $_GET["title"]: ""); ?>">
</form>

Simple example to show the idea.
If you want to send back multiple formelement, just add them together
with & (&amp;).

Regards,
Erwin Moller

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация