-
Yep. This line is wrong.
PHP Code:
$email = "Laura@Woodenteacher.org.uk", $_POST['email'];
You can't have $x = $y, $z; That's trying to assign two things to one variable, or something.
Just pick one or the other:
PHP Code:
$email = "Laura@Woodenteacher.org.uk";
//OR
$email = $_POST['email'];
The first will send to that email, and the second will send to whatever value is sent from the form with the name "email", so a text field name="email", for example.
-
What BLiZZaRD *meant* to say was:
Code:
<?php
$name = $_POST['name'];
$address = $_POST['address'];
$message = 'Address:' . "\n$address\n";
$email = 'Laura@Woodenteacher.org.uk';
mail($email, 'Prospectus Request', $message, 'From: "' . $name . '" <noreply@woodenteacher.org.uk>');
header('Location: http://www.woodenteacher.org.uk/thankyou.html');
?>
:)
-
Aye, that's what I meant. LOL
My problem with this one is that I don't really see what she wants for sure. I mean obviously an emial sent when someone fills out the form...
But sent to who? Her? The person filling out the form? Or both? I decided both, hence including her email addy and the one submitted from the form.
But still, the email will be pretty worthless, no real "message". All I can guess is that she wants notification and a name/email of someone who filled out a form, so she could manually email the person later with something else??
Like wise... if that were the case, can't she just put the php send mail on the thankyoupage.html? So then it would send from the thank you page, the user would get the "echo "Thank You, your oder has been mailed to me." on the page, and skip the whole redirection thing?
-
Hi thanks for all the info, sorry if I haven't explained myself well.
What I am trying to do, is if people visit the website and want a prospectus, they fill their name and address in, press the submit button. A thank you confirmation page comes up then that information (name and address) is sent to , in this case at the moment, the test site email address (Woodenteacher) which is then forwarded to me at my personal email address(eventually it will be set up at the client's email address/domain). I don't want any info sent to the person who is filling the form out.
What is happening, now that I have added Twey's code is when I put info into the form online and click submit the thankyou.html page comes up and when I check my email, I have a message sent with Prospectus Request in the subject line, but in the body of the email it just says 'Address:' So it is kind of working, put not giving me all the details.
Does that make sense?
-
That's because you should be using name not id as the identifiers for the form elements.
-
That's great Twey, I am now getting the address field sent to me but not the name?
-
Does your form look like this:
Code:
<form id="myform" class="cssform" action="sendmail.php" method="post">
<p>
<label for="name">Name</label>
<input type="text" id="name" value="" name="name" />
</p>
<p>
<label for="address">Address:</label>
<textarea name="address" id="address" rows="5" cols="25"></textarea>
</p>
<div style="margin-left: 150px;">
<input type="submit" value="Submit" /> <input type="Reset" value="reset" />
</div>
</form>
?
-
Twey this is my form code:
<form id="myform" class="cssform" action="sendmail.php" method="post">
<p>
<label for="user">Name</label>
<input type="text" name="user" value="" />
</p>
<p>
<label for="address">Address:</label>
<textarea name="address" rows="5" cols="25"></textarea>
</p>
<div style="margin-left: 150px;">
<input type="submit" value="Submit" /> <input type="Reset" value="Reset" />
</div>
</form>
-
That would be why then. Replace it with the code above.
-
Twey,
That is fantastic, and has sorted it!
Could I ask one last question, before I wrap up this thread?
When I press submit the thankyou.html comes up, but when I close that it closes everything(the rest of the website). I guess I need a target blank code, but I'm not sure where to put it within the PHP/form code?