Page 2 of 4 FirstFirst 1234 LastLast
Results 11 to 20 of 35

Thread: mailform without confirmation

  1. #11
    Join Date
    May 2007
    Location
    Boston,ma
    Posts
    2,127
    Thanks
    173
    Thanked 207 Times in 205 Posts

    Default

    Remove your first "mail (" on line 4.

    So line 4 should read.
    Code:
    if ($_post['to'] === "1") {

    For the being mandatory do you mean it doesn't process the data if the select isn't selected or it doesn't send.

  2. #12
    Join Date
    Jul 2006
    Location
    Antwerp, Belgium (Europe)
    Posts
    927
    Thanks
    121
    Thanked 2 Times in 2 Posts

    Default

    I mean that I want people to select "director" or "sales" or... when sending. When they haven't selected one, the mail shouldn't send and go to the error message, like it does when f.ex. you didn't fill in your name.

    This doesn't seem to work:

    Code:
    <?php
    if ($_POST["action"] == "send"){
    if ($_POST[name] != " your name" and $_POST[name] != "" and $_POST[email] != " your e-mail adress" and $_POST[email] != "" and $_POST[message] != "") { 
    if ($_post['to'] === "1") { 
    $mail_to = "info@ce.com";
    }
    if ($_post['to'] === "2") { 
    $mail_to = "admin@h.be";
    }
    if ($_post['to'] === "3") { 
    $mail_to = "me@post.be";
    }
    mail ($mail_to, "via NET",  "
    Name: ".$_POST['name']."
    E-mail: ".$_POST['email'].
    Message: ".$_POST['message']."
    ",
    "From: ".$_POST['name']." <".$_POST['email'].">");
    echo '<br>&nbsp;<br>Thanks ! <br>&nbsp;<br>Your message has been sent.<br>&nbsp;<br>&nbsp;<br> NET will get back to you within two working days.<br>&nbsp;<br>&nbsp;<br>';
    }
    else{
    echo '<br>&nbsp;<br><font color="#565656;">Your mail has NOT been sent !</font><br>&nbsp;<br>Please fill in all data.<br>Your name, email adress and message are mandatory fields.<br>&nbsp;<br>&nbsp;<br><a href="about.php"><font color="#565656;">[again please]</font></a><br>&nbsp;<br>';
    }
    }
    ?>

  3. #13
    Join Date
    May 2007
    Location
    Boston,ma
    Posts
    2,127
    Thanks
    173
    Thanked 207 Times in 205 Posts

    Default

    Sorry, captilize the posts.

    $_POST

    For mandatory change line 2 to

    Code:
    if ($_POST[name] != " your name" and $_POST[name] != "" and $_POST[email] != " your e-mail adress" and $_POST[email] != "" and $_POST[message] != "" and $_POST['to'] != "" and $_POST['to'] != "0") {

    I'd put in a test field like Select a User and set the option value there to 0. This will make the default value 0 and not equal to an email address I've put this code into the validator statment above as well.

  4. #14
    Join Date
    Jul 2006
    Location
    Antwerp, Belgium (Europe)
    Posts
    927
    Thanks
    121
    Thanked 2 Times in 2 Posts

    Default

    Still doesn't work.
    Code:
    <?php
    if ($_POST["action"] == "send"){
    if ($_POST[name] != " your name" and $_POST[name] != "" and $_POST[email] != " your e-mail adress" and $_POST[email] != "" and $_POST[message] != "") { 
    if ($_POST['to'] === "1") { 
    $mail_to = "info@erzj.com";
    }
    if ($_POST['to'] === "2") { 
    $mail_to = "admin@hetel.be";
    }
    if ($_POST['to'] === "3") { 
    $mail_to = "bno@po.be";
    }
    mail ($mail_to, "via NET", "
    Name: ".$_POST['name']."
    E-mail: ".$_POST['email'].
    Message: ".$_POST['message']."
    ",
    "From: ".$_POST['name']." <".$_POST['email'].">");
    echo '<br>&nbsp;<br>Thanks ! <br>&nbsp;<br>Your message has been sent.<br>&nbsp;<br>&nbsp;<br> NET will get back to you within two working days.<br>&nbsp;<br>&nbsp;<br>';
    }
    else{
    echo '<br>&nbsp;<br><font color="#565656;">Your mail has NOT been sent !</font><br>&nbsp;<br>Please fill in all data.<br>Your name, email adress and message are mandatory fields.<br>&nbsp;<br>&nbsp;<br><a href="about.php"><font color="#565656;">[again please]</font></a><br>&nbsp;<br>';
    }
    }
    ?>
    FYI, this is where I am testing

  5. #15
    Join Date
    May 2007
    Location
    Boston,ma
    Posts
    2,127
    Thanks
    173
    Thanked 207 Times in 205 Posts

    Default

    cancel that

    on line 17 you lost a quote

    E-mail: ".$_POST['email'].
    "Message: "

  6. #16
    Join Date
    Jul 2006
    Location
    Antwerp, Belgium (Europe)
    Posts
    927
    Thanks
    121
    Thanked 2 Times in 2 Posts

  7. #17
    Join Date
    May 2007
    Location
    Boston,ma
    Posts
    2,127
    Thanks
    173
    Thanked 207 Times in 205 Posts

    Default

    I'm not getting a 500, I'm getting a blank page. Did you try my post before this one? I hadn't seen it was a blank page i thought the problem was the code. If you get another blank page error say it's blank. To be sure it's blank hit view source nothing should be there.

  8. #18
    Join Date
    Jul 2006
    Location
    Antwerp, Belgium (Europe)
    Posts
    927
    Thanks
    121
    Thanked 2 Times in 2 Posts

    Default

    I hadn't een your post, sorry. Now the form works, but when the mail is not sent (did'nt select an option), this message appears:
    Code:
    TO IS EQUAL TO: who do you wish to contact
    Your mail has NOT been sent !
    Please fill in all data.
    Your name, email adress and message are mandatory fields.
    [again please]
    When it has been sent (selected an option and filled in all fields), this message appears:
    Code:
    TO IS EQUAL TO: 1
    TO IS 1
    Was to set?
    Thanks ! 
    Your message has been sent.
    NET will get back to you within two working days.

  9. #19
    Join Date
    May 2007
    Location
    Boston,ma
    Posts
    2,127
    Thanks
    173
    Thanked 207 Times in 205 Posts

    Default

    Okay then it's working...i think did you get an email when it was set to 1? The problem with mandatory is... assuming you changed your second line change it once more from "0" to "who do you wish to contact".

    The != means not equal to so those statements on line 2 say if such and such is not equal to nothing and not equal to the starting value then process them.

  10. #20
    Join Date
    Jul 2006
    Location
    Antwerp, Belgium (Europe)
    Posts
    927
    Thanks
    121
    Thanked 2 Times in 2 Posts

    Default

    You mean place this ?

    Code:
    <select name="to" style="width:170px; margin-top:26px;">
    <option selected value="0">who do you wish to contact</option>
    <option value="1">safaris in africa</option>
    <option value="2">places for rent in BsAs</option>
    <option value="3">ski in Argentina</option>
    </select>
    With that change, this appears:

    Code:
    TO IS EQUAL TO: 0
    Your mail has NOT been sent ! 
    Please fill in all data.
    Your name, email adress and message are mandatory fields.
    [again please]

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •