Tuesday, 13 August 2013

strlen() doesn't work with $_POST

strlen() doesn't work with $_POST

I am using this code in my *.php file
$check = $_POST['dati'];
if (strlen($check) != 0) {
// calculations
}
else {
echo "contact me at <a href='mailto:myemail'></a>";
}
The dati inside that POST is the name attribute of an input field. If the
input has a length = 0, that echo must be displayed.
I have the same code in another part of my server and it works perfectly.
I'm having troubles here because when the length of dati is 0, the script
makes the calculations instead of showing the echo.
<input name="dati" id="dati" style="width:310px" type="text">
This is the code of the input. Any ideas?

No comments:

Post a Comment