Verifying user inputs

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Ramyrezzz
    New Member
    • Jul 2007
    • 1

    Verifying user inputs

    [code=php]
    <?
    $nume=$_REQUEST['nume'];
    $subiect=$_REQU EST['subiect'];
    $email=$_REQUES T['email'];
    $precizari=$_RE QUEST['precizari'];
    $telefon=$_REQU EST['telefon'];
    $pers=$_REQUEST['pers'];
    $data=$_REQUEST['data'];
    $transport=$_RE QUEST['transport'];
    $gol=$_POST['gol'];


    mail("orizont_t ravel@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.");
    header( "Location: http://www.www.com/inscrisa.html" );
    ?>
    [/code]

    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.
    Last edited by ak1dnar; Jul 19 '07, 10:54 AM. Reason: Added [code=php] tags
  • ak1dnar
    Recognized Expert Top Contributor
    • Jan 2007
    • 1584

    #2
    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

    Comment

    • abertay
      New Member
      • Jul 2007
      • 10

      #3
      [CODE=php]
      you can make use of foreach loop


      foreach($_POST as $value)
      {
      if (!$_POST[$value])
      {
      $err .= "$value is a required field <br>";
      }
      }

      if ($err)
      {
      echo $err;
      }
      else
      {
      // Continue with script
      }
      [/CODE]
      Last edited by ak1dnar; Jul 19 '07, 12:55 PM. Reason: Added [Code=php] tags

      Comment

      • ak1dnar
        Recognized Expert Top Contributor
        • Jan 2007
        • 1584

        #4
        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

        Comment

        Working...