I have 1 field for the user to fill it then when they click Submit it sends that 1 piece of information to my email.
How can I do this?
Printable View
I have 1 field for the user to fill it then when they click Submit it sends that 1 piece of information to my email.
How can I do this?
PHP Code:<?php
$to = "[email protected]"; // The email address to send the message to.
$body ="Message here " . $_POST['textboxname']; //The body of our message. Separate lines with "\n".
$body =wordwrap($body,70); // 70 Chars per line
$subject = "Hello"; //The subject of our message.
mail($to, $subject, $body); //Send the message
?>
I need to email the information they put in the textbox to me.
this is my html form thingy:
and i need to sent the information given in that name field to my email.HTML Code:<html>
<br /><br /><br /> <center> <form action="send.php" method="POST"> name: <input type="text" name="name" /><br /> <i>(Case sensitive)</i><br /> <input type="submit" value="Submit" /> </form> </center> </html>
It does say in that html code i posted...? or i am being stupid? :P
<html> <br /><br /><br /> <center> <form action="send.php" method="POST"> name: <input type="text" name="name" /><br /> <i>(Case sensitive)</i><br /> <input type="submit" value="Submit" /> </form> </center> </html>
PHP Code:<?php
$to="[email protected]";//Theemailaddresstosendthemessageto.
$body=$_POST['name'];//Thebodyofourmessage.Separatelineswith"\n".
$body=wordwrap($body,70);//70Charsperline
$subject="Hello";//Thesubjectofourmessage.
mail($to,$subject,$body);//Sendthemessage
?>
It sends (it think) but i do not get any email
try it: www.supersurvival.net/join
still not working, anyone?
Excuse my how bad i am at html and php :PHTML Code:<html>
<br /><br /><br />
<center> <form method="POST"> Minecraft name: <input type="text" name="name" /><br /> <i>(Case sensitive)</i><br /> <input type="submit" value="Submit" /> </form> </center>
<?php mail('t.*******[@]@*****.co.uk', 'SuperSurvival', $_POST["name"][/@];); ?>
</html>
Make a separate page for your php code (e.g. mail.php).
Then link to it with your form, examplePHP Code:<form action='mail.php' method='POST'>
The mail server is probably rejecting your email(s) as spam. Try putting additional information, such as a subject, message, headers etc
mail('t.sharratt[@]@yahoo.co.uk', 'SuperSurvival', $_POST["name"])[/@];
Don't see what is wrong with that :S
yeah :S
is it possible to send the information onto a different page.
e.g:
First person submits a name
then another person does the same
then another
then another
on the page it makes a list like:
name1
name2
name3
name4
or would that be more complicated since i'd also need a to remove the name after I have read it.
change your form to
then make a new php file called write.php with this in itHTML Code:<form action="write.php" method="POST">
should create a file called name.txt with whatever people input, keep previous entries and set a new linePHP Code:<?php
$file = "./name.txt";
$write = $_POST['name'] . "\n";
file_put_contents($file, $write, FILE_APPEND);
?>
In regards to my earlier post. This could be the error? Seen as though some of the provided solutions would work.Quote:
The mail() function doesn't support SMTP authentication, so most mail servers will reject mail from sources they don't recognize.
The php mail function itself is just a pain.
-----------------------------------------------
At the post above, it is possible to display it in the same document. Make sure it's saved as a .php file, put the php code in between the <head> </head> tags. Then put your form in the <body> </body> tags.
That's what i do anyway, although I've just started learning PHP. Done like a login, register, members area and admin panel in a day. Super easy to learn, especially when I usually have to do Java.
This might be getting too hard but is there anyway you can put a check box next to each name and you can tick it and click delete and it removes it from the html file. Thats the last think i'd need doing :)
also:
Warning file_put_contents(./admin.html) [function.file-put-contents]: failed to open stream: Permission denied in /opt/lampp/htdocs/join/write.php on line 6
That so confused me on what you're trying to do :P
If I wanted the names storing I would use an SQL database upon clicking submit or send or w.e it stores the name. Then have an additional button maybe in the admin panel to delete records from that table. Or you could just delete records manually in phpmyadmin.
That's more than likely not what you wanted to do but hey ho. I think this is getting way too overcomplicated for a simple mail function :P
I don't get it ! I have the same problem !
---------- Post added 13-11-2011 at 08:39 PM ----------
www.habbtunez.com/jobs/ It doesnt send !
<?php
$to = "jobs[@]@habbtunez.com"[/@]; // The email address to send the message to.
$body ="Message here " . $_POST['textboxname']; //The body of our message. Separate lines with "\n".
$body =wordwrap($body,70); // 70 Chars per line
$subject = "Job Application"; //The subject of our message.
mail($to, $subject, $body); //Send the message
?>