<form action=""> <font size="4">Suggestions: <br><textarea name="comments" cols="50" rows="10"> </textarea><br> <input type="submit" value="Submit" /> </form>
Im a beginner and need help with using submit button and sending the text to my email
Started by mbridges, Dec 27 2010 12:57 PM
9 replies to this topic
#1
Posted 27 December 2010 - 12:57 PM
I'm making a suggestions text box, and I want to get the text that the user types to forward to my email after pressing submit. Sorry, I'm new at this but thanks for your help in advance!
|
|
|
#2
Posted 27 December 2010 - 02:27 PM
Hi,
You will most likely need a server side script such as PHP to handle the data and send it.
Can your server run PHP?
You will most likely need a server side script such as PHP to handle the data and send it.
Can your server run PHP?
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.
#3
Posted 27 December 2010 - 03:05 PM
Well I'm not sure yet, I'm just creating this in notepad right now. Should I use something else instead?
#4
Posted 28 December 2010 - 03:53 AM
Won't a <a href="mailto:whatever@dontcare.com"> be enough?
#5
Posted 28 December 2010 - 09:43 AM
Thats just trying to link me to "whatever@dontcare.com"
#6
Posted 28 December 2010 - 10:34 AM
mbridges said:
Thats just trying to link me to "whatever@dontcare.com"
<a href="mailto:whatever@dontcare.com">
This will actually open the user's desktop mail client for sending email. That way, they can compose an email to you directly.
Check out our update Guidelines/FAQ. When posting code, remember to use code tags -
.
.
#7
Posted 28 December 2010 - 12:20 PM
You can also set the body by doing
MailTo Syntax
That gives the user the option to still edit the email before sending but, as nullw0rm said. You'll need some serverside code to perform automatic emailing.
<a href="mailto:whatever@dontcare.com?body=Hi, you just received an email!">And also the subject etc..
MailTo Syntax
That gives the user the option to still edit the email before sending but, as nullw0rm said. You'll need some serverside code to perform automatic emailing.
#8
Posted 28 December 2010 - 02:41 PM
Oh okay! Thanks for the help!
#9
Posted 28 December 2010 - 07:23 PM
Hi, just in case you wish to ensure compatibility with a PHP page, you can set it up as so:
suggestion.html:
suggestion.html:
<form method="post" action="suggestion.php"> <font size="4">Suggestions:<br> <textarea name="comments" cols="50" rows="10"> </textarea><br> <input type="submit" value="Submit" /> </form>suggestion.php:
<?php
/* This will be your personal email */
$to = "john@someprovider.com";
if(isset($_POST['comments'])) {
/* This is the static email subject to show where it is from */
$subject = "This is from your suggestion box";
/* This loads the contents of the written form */
$body = $_POST['comments'];
if (mail($to, $subject, $body)) {
/* If email can be sent: */
echo "<p>Message successfully sent!, please go back to our <a href='./'>index</a></p>";
} else {
/* If an error while sending: */
echo "<p>Message delivery failed...</p>";
}
}
?>
This method does not disclose your personal email like other methods if that is worth meaning to you.
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.
#10
Posted 28 December 2010 - 07:56 PM
Thanks Nullw0rm! That was a big help!
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account


Back to top









