View Single Post
Old Apr 30th, 2006, 4:21 PM   #4
piercy
Programmer
 
Join Date: Apr 2006
Posts: 35
Rep Power: 0 piercy is on a distinguished road
the above code was an example not my real code. basically i didnt want you guys just giving me a code i wanted an example which i could extend myself. the statement i wanted really (in word terms) was:

if firstname or lastname or emailadress or message was empty
then show form again and say please fill in all fields
otherwise
send the form

thanks to sanes post about each variable needing the question (as it be). i came up with a if statment like what i just put. i understand that echo and print do the same thing i just didnt realise that each part of an if statement needed a question. as i am still learning php and have gone through if staments it seems the book i am reading to help me learn was not very clear on this matter. all of the examples i saw where only designed for one variable.

but thankyou to you both as now i have sorted the problem.
all i cna hope now is that i can complete the rest of the project without help and maybe learn php to the standard you guys are at.

just to show you what i came up wiht heres a small example.
if ( empty($a) || empty($b) || empty($c)) {
require("form.php");
echo 'please fill in all fields.'
} else { 
mail(example@example.com);
INSERT INTO test.messages;
}

as my other computer has not got internet at the moment i cannot copy and paste the code onto here but that is the main of it but obviously slightly shorthanded.

thanks again
piercy
__________________
this forum rules you guys are great!
thanks to all who help
piercy
piercy is offline   Reply With Quote