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.
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.
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> <br>Thanks ! <br> <br>Your message has been sent.<br> <br> <br> NET will get back to you within two working days.<br> <br> <br>'; } else{ echo '<br> <br><font color="#565656;">Your mail has NOT been sent !</font><br> <br>Please fill in all data.<br>Your name, email adress and message are mandatory fields.<br> <br> <br><a href="about.php"><font color="#565656;">[again please]</font></a><br> <br>'; } } ?>
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.
Still doesn't work.
FYI, this is where I am testingCode:<?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> <br>Thanks ! <br> <br>Your message has been sent.<br> <br> <br> NET will get back to you within two working days.<br> <br> <br>'; } else{ echo '<br> <br><font color="#565656;">Your mail has NOT been sent !</font><br> <br>Please fill in all data.<br>Your name, email adress and message are mandatory fields.<br> <br> <br><a href="about.php"><font color="#565656;">[again please]</font></a><br> <br>'; } } ?>
cancel that
on line 17 you lost a quote
E-mail: ".$_POST['email'].
"Message: "
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.
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:
When it has been sent (selected an option and filled in all fields), 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]
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.
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.
You mean place this ?
With that change, this appears: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>
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