When does that appear when nothing is selected?
When any are selected?
When does that appear when nothing is selected?
When any are selected?
Looks like it's working to me just remove the echos. Are you not getting emails?
DONT REMOVE ALL ECHOS. If you dont know which to remove please ask.
I received your 2 test emails so far.
May I ask you which echo's to remove, please ?
Walrus, I have NO IDEA of php !
Please note that now the mail is sent without selecting an option !
No, sorry, the mail gets not send, but the message on the site says it has !
Can you post your full php code? I'll remove the echos you don't need and look for the unknown !. I'll post back in about 1/2 hour gotta run right now.
This is the php so far:
And this is the form:Code:<?php echo "TO IS EQUAL TO: " . $_POST['to'] . "<br />"; 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") { echo "TO IS 1<br />"; $mail_to = "info@cego.com"; } if ($_POST['to'] === "2") { echo "TO IS 2<br />"; $mail_to = "admin@hrdeel.be"; } if ($_POST['to'] === "3") { echo "TO IS 3<br />"; $mail_to = "bro@post.be"; } echo "Was to set?<br />"; 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>'; } } ?>
Regarding the not sending of message when not selected an option, but showing the 'message sent': could it have to do with the selected value="0" ?Code:<select name="to" style="width:170px; margin-top:26px;"> <option selected value="0">what is your message about</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>
Not sure try just value though, I think the default value is the first value so you should be all set there anyway.
PHP 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'] != "" and $_POST[to] != "" and $_POST['to'] != "0") {
if ($_POST['to'] === "1") {
$mail_to = "info@cego.com";
}
if ($_POST['to'] === "2") {
$mail_to = "admin@hrdeel.be";
}
if ($_POST['to'] === "3") {
$mail_to = "bro@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>';
}
}
?>
All works well, except that, when not selecting an option, the mail does not get sent, but the message that the mail has been sent, appears. How come ?
I'm going to run 4 tests.
Test one nothing be entered returned this.
Test two
Your mail has NOT been sent !
Please fill in all data.
Your name, email adress and message are mandatory fields.
[again please]
Test threeThanks !
Your message has been sent.
NET will get back to you within two working days.
test fourThanks !
Your message has been sent.
NET will get back to you within two working days.
If this is working you should have 3 emails with subject email and message all being the same, but different per email address. If you do not let me know which you did not get.Thanks !
Your message has been sent.
NET will get back to you within two working days.
Bookmarks