homepage Welcome to WebmasterWorld Guest from 107.22.70.215
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
Send Form Via Email And Make It Submit
nort99




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

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




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

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




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

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




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

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




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

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




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

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




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

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




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

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




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

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




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

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

nort99




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

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




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

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




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

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

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved