Danny620 Posted July 12, 2009 Share Posted July 12, 2009 i get a error saying Parse error: parse error in C:\xampp\htdocs\val.php on line 13 <?php require_once('access/mysqli_connect.php'); //Function val validates form submissions by; //Striping html tags from from; //Must be greater than three letters long; function val($field = false){ global $dbc; $errors = false; if(strlen($field) > 3) && (strstr($field)){ strip_tags($field); $username = $field; $username = mysqli_real_escape_string($dbc,$username); return $username; } else { $errors = "Field must be greater than three letters long!"; } if($errors){ echo $errors; } } //END of val function; ?> Quote Link to comment https://forums.phpfreaks.com/topic/165721-need-help/ Share on other sites More sharing options...
wildteen88 Posted July 12, 2009 Share Posted July 12, 2009 Remove the highlighted character on this line if(strlen($field) > 3) && (strstr($field)){ Quote Link to comment https://forums.phpfreaks.com/topic/165721-need-help/#findComment-874208 Share on other sites More sharing options...
Philip Posted July 12, 2009 Share Posted July 12, 2009 if(strlen($field) > 3) && (strstr($field)){ if(strlen($field) > 3 && strstr($field)){ Notice the parenthesis. Quote Link to comment https://forums.phpfreaks.com/topic/165721-need-help/#findComment-874209 Share on other sites More sharing options...
Danny620 Posted July 12, 2009 Author Share Posted July 12, 2009 when i changed it i got Warning: Wrong parameter count for strstr() in C:\xampp\htdocs\val.php on line 13 Quote Link to comment https://forums.phpfreaks.com/topic/165721-need-help/#findComment-874213 Share on other sites More sharing options...
Danny620 Posted July 12, 2009 Author Share Posted July 12, 2009 let me get this right does strstr() check if its and string and checks if it contains any numbers Quote Link to comment https://forums.phpfreaks.com/topic/165721-need-help/#findComment-874215 Share on other sites More sharing options...
Philip Posted July 12, 2009 Share Posted July 12, 2009 No? strstr in the manual - maybe you should look at that Quote Link to comment https://forums.phpfreaks.com/topic/165721-need-help/#findComment-874217 Share on other sites More sharing options...
Danny620 Posted July 12, 2009 Author Share Posted July 12, 2009 oh lol then whats the one to check if its a string and does'tn contain any numbers Quote Link to comment https://forums.phpfreaks.com/topic/165721-need-help/#findComment-874220 Share on other sites More sharing options...
Philip Posted July 12, 2009 Share Posted July 12, 2009 I dont think there is one that will default check to make sure there aren't any numbers in it - since a string can contain numbers. is_string[/code] ? Quote Link to comment https://forums.phpfreaks.com/topic/165721-need-help/#findComment-874221 Share on other sites More sharing options...
Danny620 Posted July 12, 2009 Author Share Posted July 12, 2009 what i would like to achive is a function that will make sure there is more than 3 letters strip html out take numbers out make sure its safe to insert into a database this is what i got so far. can any one point me in the rigth direction of doing this. <?php require_once('access/mysqli_connect.php'); //Function val validates form submissions by; //Striping html tags from from; //Must be greater than three letters long; function val($field = false){ global $dbc; $errors = false; if(strlen($field) > 3 && strstr($field)){ strip_tags($field); $username = $field; $username = mysqli_real_escape_string($dbc,$username); return $username; } else { $errors = "Field must be greater than three letters long!"; } if($errors){ echo $errors; } } //END of val function; ?> Quote Link to comment https://forums.phpfreaks.com/topic/165721-need-help/#findComment-874228 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.