Hello, I have a short question. I would like to reset a variable that is going to be posted:
I will post a variable that comes from an input field. When this variable $_POST['a']; is empty, I would like to fill it with new content.
The scheme is like that:
empty variable will be posted -> php recognizes that it is empty -> giving it new content -> echoing out new content.
This is just simple but it doesnt work for me.
So here is what I have:
$a = $_POST['a'];
if( empty($a){
$errors['a'][]="text";
$a =="new content";
}
So if there is someone whould could tell me whats being wrong with this, I really would appreciate. Thanks a lot.
$a =="new content";doesn't look right. You probably want 1 equal sign for an assignment instead of a comparison.=and==is different operators. You should use=in assignment and==in compassion.