Timms
05-29-2012, 01:07 PM
I made a script to submit the information to mysql database... but now i need to check the strings that were submitted and every example i find does not seem to help atall so i come up with something simple like this
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
}
username and comment1 are both fields that are on the index page and this code is processed on the submit button
as you can see im trying to make it stop if the username is not there then check to see if the comment is there and if they are both there carry on.
It will stop but it always stops even if the data is there. Kind of new to this code need some help desperatly!
Thanks in advance
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
}
username and comment1 are both fields that are on the index page and this code is processed on the submit button
as you can see im trying to make it stop if the username is not there then check to see if the comment is there and if they are both there carry on.
It will stop but it always stops even if the data is there. Kind of new to this code need some help desperatly!
Thanks in advance