[thelist] Validating Forms with Javascript Disabled

deboute benjamin deboute at fr.clara.net
Thu Aug 31 02:59:50 CDT 2000


At 18:42 30/08/00 -0400, you wrote:
>also, all my form fields have server-side script to capture any pre-
>entered fields and display the data in the form field (for ASP, that is 
><input type="text" ... name="foo" value="<% = Request("foo") 
>%>">, assuming i haven't defined my variables already)...


and for php ::
<input type="text" name="foo" value="<? if(isset($foo)) { echo $foo; } ?>"
if variables !defined at the start of your page.

<input type="text" name="foo" value="<?=$foo?>"



 > If there is an error in
 >the entry (i.e. form field is blank) how do I redirect the user back to the page
 >containing the form,

in php

<?
if (isset($HTTP_POST_VARS) && $HTTP_POST_VARS != '') {

check them...

}

if( check not good) {
?>

<html>
<body>
<form action="<?=$PHP_SELF?>" method="post">
<input type="text" name="foo" value="<?=$foo?>">
</form>
</body>
</html>

<?
exit;
}
else {
  ..........................form treatment..........................
}





More information about the thelist mailing list