This is a discussion on "no idea where to start, email form" within the PHP Forum section. This forum, and the thread "no idea where to start, email form are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
no idea where to start, email form
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
#1
|
||||
|
||||
|
no idea where to start, email form
i am trying to create an email php script for this form, and thus far had no luck, would someone mind giving me a hand as i have no clue how to do it ( please change what you need to make it work ) - i also need it to go to a 'thank you page'
thank you
Last Blog Entry: Strict and Transitional Doctype's (Sep 12th, 2008)
Last edited by saltedm8; May 23rd, 2007 at 09:37. |
|
|
|
#2
|
|||
|
|||
|
Re: no idea where to start, email form
Here's a starter ...
1. Surround the table with tags <form action=pyjamas.php method=POST> and </form> so that the submit button knows what / where to submit 2. At the URL given for the action add something like this to your web site: <?php $em = ""; foreach (array_key($_POST) as $field) { $em .= "$field: $_POST[$field]\n\n"; } mail("george@whitehouse.com,"A user's input",$em); ?> <html> <body> Thank you. We have emailed that to the president </body> </html> |
|
#3
|
||||
|
||||
|
Re: no idea where to start, email form
ok, i have a better idea, what is wrong with this
thanks
Last Blog Entry: Strict and Transitional Doctype's (Sep 12th, 2008)
Last edited by saltedm8; May 23rd, 2007 at 09:15. |
|
#4
|
|||
|
|||
|
Re: no idea where to start, email form
Quote:
2. You really should use arrays / loops for code like this - it is much longer than it needs to be and very hard to get every line right and longwinded to maintain. |
|
#5
|
||||
|
||||
|
Re: no idea where to start, email form
i dont have a clue about any php, i used a free script and added my fields. http://www.tele-pro.co.uk/scripts/contact_form/ , thanks, i will close the spaces
Last Blog Entry: Strict and Transitional Doctype's (Sep 12th, 2008)
|
|
#6
|
||||
|
||||
|
Re: no idea where to start, email form
ok, i now have
http://www.fmat.co.uk/email.html
Last Blog Entry: Strict and Transitional Doctype's (Sep 12th, 2008)
Last edited by saltedm8; May 24th, 2007 at 20:56. |
|
#7
|
|||
|
|||
|
Re: no idea where to start, email form
Yes, because a form is regarded as "good" if a field called "EmailFrom" and "bad" if there is no data in such a field. Your form doesn't have a field of that name, so it can never be good as it stands ...
|
|
#8
|
||||
|
||||
|
Re: no idea where to start, email form
ok, i have finally got it working ( or at least thats what its telling me - i have not recieved the emails yet ), will it display the sucess page and not send it ?
Last Blog Entry: Strict and Transitional Doctype's (Sep 12th, 2008)
Last edited by saltedm8; May 23rd, 2007 at 22:27. |
|
#9
|
|||
|
|||
|
Re: no idea where to start, email form
The "success" flag from the mail function only indicates that you have correctly passed the email to the first computer in the mail system - in other words that you have put the letter into the post box. It does not tell you whether it was correctly addressed (so will reach the intended recipient) nor if it will get caught on the way by a spam filter. It might even be that the local mail server isn't connected to the mail network - so that in effect you have posted your letter in a post box museum from which mail is never connected.
Try sending a simple email - just a one-liner in PHP with constant values - to yourself. |
|
#10
|
||||
|
||||
|
Re: no idea where to start, email form
ok, recievied it this morning, - the only problem is that is sent me EVERY option, including the ones i did not choose, so i would have no clue as to which choices a client would have made, how do i get around that ?
Last Blog Entry: Strict and Transitional Doctype's (Sep 12th, 2008)
Last edited by saltedm8; May 24th, 2007 at 05:37. |
|
#11
|
|||
|
|||
|
Re: no idea where to start, email form
When a user makes a selection from the menu, and clicks submit the value of the choice or "option value" is stored in the value of $_POST['referal']; this is because you have named the entire drop down menu as "referal". So, simply email yourself the value of $_POST['referal'] and you will only be told the option they selected. eg;
Checkbox's are a little different, they simply return 1 if they were selected, and 0 if they werent... however, a simply if else statement can change these binary values into the form of yes/no if you wish .... i dont bother 9 times out of 10. hope this helped a little |
|
#12
|
||||
|
||||
|
Re: no idea where to start, email form
ok, thank you, i think i have got the $referal = $_POST['referal']; bit, but i am unsure on the radio buttons, i will give it a go and let you know
cheers
Last Blog Entry: Strict and Transitional Doctype's (Sep 12th, 2008)
|
|
#13
|
||||
|
||||
|
Re: no idea where to start, email form
ok, i have managed a few things, this is what i have now
FullName: *works* EmailAddress: *works* Address: xx *works* citytown: Sittingbourne *works* Region: xx *works* PostcodeZip: xx *works* Telephone: xx *works* CurrentWebsiteURL: *works* CompanyName: *works* Referral: Referral **drop down not working** Department: Department ** drop down not working** DoYouCurrentlyHaveHosting: **radio buttons not working** Message: this is a test of the mail form... *works* 3 problems, the drop down options not 'catching' the option chosen and the radio buttons not working still cheers
Last Blog Entry: Strict and Transitional Doctype's (Sep 12th, 2008)
Last edited by saltedm8; Aug 9th, 2008 at 15:22. |
|
#14
|
|||
|
|||
|
Re: no idea where to start, email form
On your radio buttons, you have your "name" and "value" fields reversed.
On your selects, you need to give a different value (which is the string you want back) for each value. |
|
#15
|
||||
|
||||
|
Re: no idea where to start, email form
horray, its working perfect, i can only thank you for your help. hope i can do the same for you one day
Last Blog Entry: Strict and Transitional Doctype's (Sep 12th, 2008)
|
![]() |
| Tags |
| email form |
| Thread Tools | |
|