Jump to content

Archived

This topic is now archived and is closed to further replies.

redarrow

valadation problam

Recommended Posts

i can not post the whole code as it's 1400 lines long sorry but the example is below cheers.

hi there all can you see why the valadation wont work please.

does not seem to valadate.
[code]
<?php

$name_lenth=strlen($name);
$password_lenth=strlen($password);

if(($name_lenth )||($password_lenth) > 15){

echo " sorry but name and password are only max 15 characters long ";

}
?>
[/code]

Share this post


Link to post
Share on other sites
[code]if(($name_lenth )||($password_lenth) > 15){[/code]

should be

[code]if(($name_lenth > 15) || ($password_lenth > 15)){[/code]

Share this post


Link to post
Share on other sites
[code]if ($name_lenth>15||$password_lenth>15) {[/code]

That work?

Share this post


Link to post
Share on other sites
They work exactly the same, some people find the parenthesis...()...easier to read, but the functionality is the same.

Share this post


Link to post
Share on other sites
cheers.

what i need to now now is when you get a user to fill in a form and use exit and give them a link to go back and try agin do you use sessions to keep there old settings or do you get them to fill it all in agin .

or do you keep the most inportant in a session.

Share this post


Link to post
Share on other sites
What i do is if i run into any errors i store them in a $error variable via .= and if there were any errors echo $error and then have the form have the values they just submitted in it by echo the post variables like value="<?=$_POST['name'];?>" That way it doesnt validate but they dont have to retype everything...

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.