By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,727 Members | 1,340 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,727 IT Pros & Developers. It's quick & easy.

Verifying user inputs

P: 1
Expand|Select|Wrap|Line Numbers
  1. <?
  2.     $nume=$_REQUEST['nume'];
  3.     $subiect=$_REQUEST['subiect'];
  4.     $email=$_REQUEST['email'];
  5.     $precizari=$_REQUEST['precizari'];
  6.     $telefon=$_REQUEST['telefon'];
  7.     $pers=$_REQUEST['pers'];
  8.     $data=$_REQUEST['data'];
  9.     $transport=$_REQUEST['transport'];
  10.     $gol=$_POST['gol'];
  11.  
  12.  
  13.     mail("orizont_travel@yahoo.com",$subiect, "Ma numesc $nume, si doresc sa rezerv $subiect pentru $pers persoane in data de $data. ma puteti contacta pe email, $email sau la numarul de telefon $telefon. mai am de adaugat $precizari, multumesc mult.");
  14. header( "Location: http://www.www.com/inscrisa.html" );
  15.     ?>
  16.  
I have this code to send email from website to me.
can someone show me how to make an field existance verification code?
like if the "data" field is empty, to post a msg on the site with "data" filed is empty ?
Thanks.
Jul 19 '07 #1
Share this Question
Share on Google+
3 Replies


ak1dnar
Expert 100+
P: 1,584
Hi Ramyrezzz,

Welcome to TSDN !

Since you have post your question under this thread(
In PHPMailer, can we set the To adress and BCC address as same
) I have to Make it as a new thread.

And please do not double post the same question to the thread.
Thanks!

Please wait until one of our expert comes to the thread.

-Ajaxrand
Jul 19 '07 #2

P: 10
Expand|Select|Wrap|Line Numbers
  1. you can make use of foreach loop 
  2.  
  3.  
  4. foreach($_POST as $value) 
  5. {
  6. if (!$_POST[$value]) 
  7. {
  8. $err .= "$value is a required field <br>";
  9. }
  10. }
  11.  
  12. if ($err)
  13. {
  14. echo $err;
  15. }
  16. else
  17. {
  18. // Continue with script
  19. }
  20.  
Jul 19 '07 #3

ak1dnar
Expert 100+
P: 1,584
Hi there,

I need a big favour from you.
Please click here to find out the most important link(s) in the forum.
when you using the Forum please be good enough to use what it says to you.hope you will do that.Thanks for your time!

-Ajaxrand
Jul 19 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.