Welcome to WebmasterWorld Guest from 54.196.238.210

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Send Form Via Email And Make It Submit

     

nort99

2:52 am on Jul 26, 2010 (gmt 0)

5+ Year Member



I want to send my form by email. When I do this and insert the info and click on submit, I do not receive and data. Now my form works just great on the web page and send me the data that was inputed. But in an email the php does not seem to work. Can any one help me out here on how to make this work. Thanks.

andrewsmd

2:32 pm on Jul 26, 2010 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member



What are you using to send email? The mail function? If so, try doing a var_dump(mail(your mail options here)); and see what it outputs. You can always use a different way to send mail. I have a script that uses the gmails servers to send mail if you would like to see it.

nort99

12:41 am on Jul 27, 2010 (gmt 0)

5+ Year Member



I more than likely will be using MS Outlook to mail the forms out. What the people on the other end will be using to submit the form back I have no idea what they have. I guess when they hit submit there input does not make it back the server where the php is located in an email?

andrewsmd

1:03 am on Jul 27, 2010 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member



If you are using outlook, then the php won't be parsed because that file is sitting on your server. How experienced are you with web programming? If you're going to send these forms out with outlook, then you need a domain to email people. I.e. Please fill out my form at example.com/form.php.

nort99

1:19 am on Jul 27, 2010 (gmt 0)

5+ Year Member



I have that in place. I really don't want to send them a link to the site. I would really like them to be able to answer the form in the email that I send them. But if this can't happen then I will have to back up and rethink a bit.

andrewsmd

1:28 pm on Jul 27, 2010 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member



There's no way to send them this code via email and have it run. They way php works is, it sits on your server. When someone requests your page, your server realizes that it has a .php extension. Wherever it finds the <? tags, it parses the php and returns html to the user. The end user never see's the php. Most people don't have a php engine on their machine so even if they received this code, they would have no idea what to do with it. Also, my guess is, most spam filters are going to mark this message as spam if you try to send server side code within the email. The ONLY way you can have them fill out this form and submit it via php is by some sort of domain.

omoutop

1:53 pm on Jul 27, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



correct me if i understood wrong, but you want to do something like this:

- php : create a mail body message with a some form fields in it (form action would look like http://www.example.com/process.php for example) and send it to a mailing list of recipients
- recipient receives this html email, fills form and press submit
- form sends data to form action url (http://www.example.com/process.php)
- php process that data and redirects to a thank you page

Did i understand you correctly?

What happens if recipient can't receive html emails?

andrewsmd

2:09 pm on Jul 27, 2010 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member



Another good point. You really need to rethink your process. Even if a spam filter didn't catch it, I know anyone using exchange would not be able to use it because exchange strips out things it views as a security risk when processing html emails.

rocknbil

5:50 pm on Jul 27, 2010 (gmt 0)

WebmasterWorld Senior Member rocknbil is a WebmasterWorld Top Contributor of All Time 10+ Year Member



While Andrew is correct, there may be a misunderstanding of the problem.

You can indeed SEND a recipient an HTML email that contains a form, It may even render in their email client as a form with form fields and a submit button.

The problem is that most, if not all, email clients don't have the functionality to post data from a form. They are not browsers, they are email clients.

What will happen is

<form action="example.com/myscript.php">

it will just go to that URL as if it were a link in the email, and won't carry any of the form data with it, with either the method post or get.

andrewsmd

6:07 pm on Jul 27, 2010 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member



My apologies for any misunderstandings. That's what I was trying to say.

nort99

1:19 am on Jul 28, 2010 (gmt 0)

5+ Year Member



omoutop yes you are correct that is what I want to do.


rocknbil Your example is just what happens.


andrewsmd All of my recipient will be able to get mail in HTML. I guess I will have to come up with a different way to do this. Thank you all for your help.

omoutop

11:39 am on Jul 28, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



best approach i can think is to provide a link in your email
the link will open in a web page-form, where your client can fill as usual from his/hers browser window.

MikkiMouse

2:59 pm on Jul 31, 2010 (gmt 0)

5+ Year Member



You can read php form [phpforms.net] tutorials. They have some good examples
 

Featured Threads

Hot Threads This Week

Hot Threads This Month