I am adapting a script from here, to use as verification when form is posted.
This is the code being sent form the form page:
<?php
$secret1 = '00001';
?>
And the code from the action page:
if(!empty(htmlentities($_POST['secret1'])) {
if(htmlentities($_POST['secret1']) == '00001') {
echo 'PASS';
}
}else { echo 'ERROR'; }
However, when I submit the form, I get "Can't use function return value in write context" error.
Am just starting to learn php so can't really identify the problem. Can you please help?
Thanks.
You are trying to pass a function return (htmlentities) to empty. Change your first line to:
if(!empty($_POST['secret1'])) {