I need to make a script that sends information to a mysql data-base. Sending this info to the data-base and storing it is not an issue but new to php im stuck on a stupid place and cant find an answer off people on other places!
what i got is 2 text fields where the user inputs their name and a comment… yes basicaly like a guest book but not.
thats done and the data to mysql gets sent perfectly.
Now what i need to do is stop if one of the fields or if both of the fields are empty.
So what i thought would work dosent…
It stops but it also stops if there is text in the fields so i need some sample code of how i would go about doing these if statements because everywhere i look i cant seem to find anything i understand lol
so this is what i thought would work but dosent.
[php]if (!strlen(trim($_REQUEST[‘usersname’]))){
die(‘Please go back and enter out the required name!’);
}
elseif (!strlen(trim($_POST[‘comment1’]))){
die(‘Please go back and enter out the required comment!’);
}else{
///process all my mysql data past this line
} [/php]
could someone please help me thanks!