Could anybody out there please explain teh simplest way for me to have my form data sent directly to me without using the mailto: option. The mailto: option kicks the outlook express into action and I know a lot of people dont use that nowadays due to hotmail/gmail etc. I was looking for an option where my form is filled in and when they hit submit it just pings over to me without the need for their email client to kick in. ANy options much appreciated, with a step by step guide of course Thanks in advance. DW
One of the simplest ways is to use PHP. When you make a form with method post and action is i.e. send.php. In that php file you must get all that POST variables (fields in your form), formating and send with mail function.
I may sound arrogant here. But could you explain that in simple terms pls. Is there a webpage with step by step guide etc? Thanks EDIT: I have just been thinking and wondered if php would be any use as the page is already built in html. To give you and idea of whatI want here is the test page in question. praiadarochaonline.com/castelosdarochatest.html the form is at the bottom of the page and I would rather the info is just filled in and then pinged to me rather than opening somebodies mail client etc. Any suggestions most welcome. Thanks again, DW.
From your question I see that HTML and PHP are not familiar to you, anyway i'll give you some details: 1. You must define what user should enter. Let say email, name and comment. 2. Make form: <FORM METHOD="POST" ACTION="send.php"> <H2>Please post your comment</H2> <BR> Name: <INPUT TYPE="TEXT" NAME="username"> <BR> E-mail: <INPUT TYPE="TEXT" NAME="useremail"> <BR> Comment: <BR> <TEXTAREA NAME="usercomment" ROWS="7" COLS="35"></TEXTAREA> <BR> <INPUT TYPE="SUBMIT" VALUE="sendemail"> </FORM> Code (markup): 3. Put this form on your page 4. Make send.php and put this into: <HTML> <HEAD> <TITLE>Sending e-mail</TITLE> </HEAD> <BODY> <?php $username=$HTTP_POST_VARS["username"]; $usermail=$HTTP_POST_VARS["usermail"]; $usercomment=$HTTP_POST_VARS["usercomment"]; $mail_from="your.site@email.address"; $mail_to="your@email.address"; $mail_subj="New comment"; $mail_body="User: $username \n From: $usermail \n Posted comment: $usercomment"; mail(trim($mail_to),trim($mail_subj),$mail_body,"From: ".trim($mail_from)); ?> <H2>Your data sent</H2> </BODY> </HTML> Code (markup): Change values of $mail_from,$mail_to,$mail_subj,$mail_body to fit your needs, and upload this file to server. This file must be in the same directory as html file with form, in other case change ACTION value on form to proper path. Of course this is general answer, and you must edit it to fit your needs.
Thanks rile. Have used teh code but when the mail comes thru it doesnt have the email address attached.
Yes, I see error. My mistake... Line: $usermail=$HTTP_POST_VARS["usermail"]; Code (markup): change into $usermail=$HTTP_POST_VARS["useremail"]; Code (markup): try now... other fields ok?
Have to be honest, I cant even spot the change but it works lol. Ill just add my own little bits to it and it will do the job just right for me. Your help is much appreciated. Is nice to be given an answer rather than a quote to do the work on my behalf.
Sorry to be a pain again. BUT. Once it goes to the "YOUR DATA SENT" page I would like to have a link on there to enable people to get back to the main site. What would be the code for this? Thanks again, DW
You can do something like this: send.php <?php $username=$HTTP_POST_VARS["username"]; $usermail=$HTTP_POST_VARS["useremail"]; $usercomment=$HTTP_POST_VARS["usercomment"]; $mail_from="your.site@email.address"; $mail_to="your@email.address"; $mail_subj="New comment"; $mail_body="User: $username \n From: $usermail \n Posted comment: $usercomment"; mail(trim($mail_to),trim($mail_subj),$mail_body,"From: ".trim($mail_from)); header( 'Location: http://www.your_site.com/your_page.html' ); ?> Code (markup): Note that html tags aren't in send.php, send.php execute and redirect to http://www.your_site.com/your_page.html