i just want to check whether my $_POST has 'Project :' in it or not. But its getting failed ! Can i know why ?
if (substr($_POST['project'],0,8) == 'Project :'){ $project = $_POST['project']; }
You can try the following
if(strpos($_POST['project'], 'Project :') !== false) {
$project = $_POST['project'];
}
I suggest reading the documentation on the substr
function. The second parameter is the starting position, the third is the length. That means you can only have an 8 character output.
Project :
^
123456789
You got one character too many. Try changing the 0,8
to 0,9
Using the link I provided you in a comment.
If the use of substr
isn't mandatory, I suggest you to use strpos
that way:
if (strpos($_POST['project'], 'Project :') !== false) {
$project = $_POST['project'];;
}
Hope it helps.