Jump to content

Checking characters in a string


brent123456

Recommended Posts

if (stripslashes(trim($_POST['discription']) && (strlen($_POST['discription'] < 75)))) {
                $d = escape_data($_POST['discription']);
   print strlen($_POST['discription']) ;
                } else {

                        $d = false;
                        echo '<p><font color="red" size="+1">Please enter your Feedback!</font></p>';
        		}

 

This doesn't seem to be validating is there something wrong with my code? Even when $_POST['discription'] is more then 75 characters it is not going to the else option.

Try this:

 

<?php

$description = stripslashes(trim($_POST['discription']));

if (strlen($description) < 75) { //If description is LESS than 75 chars

$d = escape_data($description); //I'm assuming escape_data() is a function you wrote?
print strlen($description);

} else { //Do this if description is MORE than 75 chars

$d = false;
echo '<p><font color="red" size="+1">Please enter your Feedback!</font></p>';
}

?>

Archived

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

×
×
  • Create New...

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.