glennda Posted February 9, 2010 Posted February 9, 2010 Hiya, I am trying to make the a form to go onto our website, so that parents can email in a change of data e.g email address. I don't think it should be done on the web personally but thats not up to me. my question is how can i make this form auto submit without it having to open in outlook etc the main parts of the page are here <br /> function SubmitForm() <br /> {<br /> document.form1.action = "mailto:emailaddress@domain";<br /> document.form1.submit() <br /> }<br /> function ResetForm() <br /> {<br /> document.form1.reset()<br /> }<br /> </pre><form name="form1" action=""> Students Name Your Name: Contact Email: DOB of Student: Details to be Updated: Email Address Home Address I am only doing this so that you have to work lots! Please give further details here: Please Provide Further Information Here ; Submit < Any help most apreciated
Gatt Posted February 9, 2010 Posted February 9, 2010 I think you will need to use something like ASP/ASPX or PHP to acheive this - dont think it can be done via HTML/JScript 1
glennda Posted February 9, 2010 Author Posted February 9, 2010 im guessing i need to change the Submit I know i will need to add an action into the </pre><form name method="post" action="submit.php">< or something similar, but i don't have a clue/have never used PHP or ASP. do you know what i need to put in a PHP/asp Script to make it work?
Gatt Posted February 9, 2010 Posted February 9, 2010 These links might help.. PHP Tutorial: Writing Your First PHP Script: A Feedback Form (a FormMail Script) (thesitewizard.com) Google 1
glennda Posted February 9, 2010 Author Posted February 9, 2010 Fantastic thanks for your help, it now works! Toby
glennda Posted February 9, 2010 Author Posted February 9, 2010 I have now managed to break it! by trying to update it to my own needs, I have edited the PHP file so that it reads $email = $_REQUEST['email'] ; $studentname = $_REQUEST['StudentsName'] ; $parentname = $_REQUEST['parentsname'] ; $studentdob = $_REQUEST['DOBStudent'] ; $needforchange = $_REQUEST['needforchange'] ; $furtherinfo = $_REQUEST['furtherinfo'] ; mail( "[email protected]", "Parent Update Form", $studentname, $parentname, $email, $studentdob, $needforchange, $furtherinfo, "From: $email" ) ; header( "Location: /Test/thankyou.html" ); ?> I have added the extra requests and put in my email address, but i don't seem to be getting the actual email, although it is going though the script seems to be running fine. but as far as i can see it is correct this is what i have editied $email = $_REQUEST['email'] ; $message = $_REQUEST['message'] ; mail( "[email protected]", "Feedback Form Results", $message, "From: $email" ); header( "Location: http://www.example.com/thankyou.html" ); ?>
glennda Posted February 9, 2010 Author Posted February 9, 2010 Fantastic thanks for your help, it now works! Toby I jumped th gun abit with this!
srochford Posted February 10, 2010 Posted February 10, 2010 Something like this will work. First block is your data entry page, second is submit.php I think the only real problem was that you were trying to send multiple chunks in the email and you can't - there has to be 1 item for sender, 1 for subject, 1 for message body, 1 for other headers so what you do is join them together (today's big word: concatenate :-)) and in PHP this is done with the "." The other changes I've done are just a bit cosmetic - the "\t" character inserts a tab; the "\n " a new line. That works nicely in the plain text email but not on the web page so the final bit replaces the \n characters with HTML breaks () One of the reasons I rarely use PHP is that I find it harder to debug than ASP or ASP.Net - the default settings seem to be that the page just completely dies if there are any errors (even just a missing ; right at the end!) whereas ASP etc will run to the error point so at least you've got a fighting chance! Update Info </pre><form name="form1" action="submit.php" method="post"> Student Name: Your Name: Contact Email: DOB of Student: Details to be Updated: Email Address Home Address I am only doing this so that you have to work lots! Please give further details here: Please Provide Further Information Here </form><br><b Thanks Thank you for your information $email = $_REQUEST['email'] ; $studentname = $_REQUEST['studentname'] ; $parentname = $_REQUEST['parentname'] ; $studentdob = $_REQUEST['DOBStudent'] ; $needforchange = $_REQUEST['dataforchange'] ; $furtherinfo = $_REQUEST['furtherinfo'] ; $body=$body."student:\t".$studentname."\n"; $body=$body."DOB:\t".$studentdob."\n"; $body=$body."Reason:\t".$needforchange."\n"; $body=$body."Info:\t".$furtherinfo."\n"; $headers="From:".$email; mail( "[email protected]", "Parent Update Form",$body,$headers) ; echo str_replace("\n"," ",$body); ?> This has now been submitted 1
glennda Posted February 10, 2010 Author Posted February 10, 2010 Thanks, I will give it a try, but unfortuantly our web host seems to have removed my write permissions to out webserver root! so i cannot test it yet!
glennda Posted February 10, 2010 Author Posted February 10, 2010 Its working!! now i think i stop tweaking it! It does what I need it to do, only cosmetic changes!
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now