redarrow Posted August 20, 2006 Share Posted August 20, 2006 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] Link to comment https://forums.phpfreaks.com/topic/18065-valadation-problam/ Share on other sites More sharing options...
hitman6003 Posted August 20, 2006 Share Posted August 20, 2006 [code]if(($name_lenth )||($password_lenth) > 15){[/code]should be[code]if(($name_lenth > 15) || ($password_lenth > 15)){[/code] Link to comment https://forums.phpfreaks.com/topic/18065-valadation-problam/#findComment-77432 Share on other sites More sharing options...
Yesideez Posted August 20, 2006 Share Posted August 20, 2006 [code]if ($name_lenth>15||$password_lenth>15) {[/code]That work? Link to comment https://forums.phpfreaks.com/topic/18065-valadation-problam/#findComment-77433 Share on other sites More sharing options...
redarrow Posted August 20, 2006 Author Share Posted August 20, 2006 what ones more better to use they both work or is it prefrence Link to comment https://forums.phpfreaks.com/topic/18065-valadation-problam/#findComment-77435 Share on other sites More sharing options...
hitman6003 Posted August 20, 2006 Share Posted August 20, 2006 They work exactly the same, some people find the parenthesis...()...easier to read, but the functionality is the same. Link to comment https://forums.phpfreaks.com/topic/18065-valadation-problam/#findComment-77438 Share on other sites More sharing options...
redarrow Posted August 20, 2006 Author Share Posted August 20, 2006 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. Link to comment https://forums.phpfreaks.com/topic/18065-valadation-problam/#findComment-77445 Share on other sites More sharing options...
corbin Posted August 20, 2006 Share Posted August 20, 2006 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... Link to comment https://forums.phpfreaks.com/topic/18065-valadation-problam/#findComment-77460 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.