Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => Mail

php email whole page

the mail() function

Moderators: macek, egami, gesf

php email whole page

Postby bhenry » Mon Feb 06, 2006 8:33 am

Sorry if this question seems basic i am fairly new to php. i have a html form that when completed it sends them to a php page for them to verify the information. I am trying to make a link at the bottom of the php page that will e-mail the entire page to me. any help would be greatly appreciated.
bhenry
New php-forum User
New php-forum User
 
Posts: 5
Joined: Thu Feb 02, 2006 9:08 am

Postby bhenry » Tue Feb 07, 2006 12:06 pm

Update: I can send the page as a link, but because of the nature of the page when the link is selected it the input data is not there. The best solution would be to have the page embeded into the body of the e-mail. I though a link to the pages I am working on might be helpful [url]h1.ripway.com/bhenry/consent1.html[/url]
bhenry
New php-forum User
New php-forum User
 
Posts: 5
Joined: Thu Feb 02, 2006 9:08 am

Postby gesf » Tue Feb 07, 2006 12:34 pm

You need to send the gererated data (after submittion)... right ? So... that's all you need to do!
User avatar
gesf
Moderator
Moderator
 
Posts: 1718
Joined: Sun Dec 29, 2002 5:03 am
Location: Portugal / Sweden

Postby bhenry » Tue Feb 07, 2006 12:43 pm

I need the generated data i.e. user imputs, but i also need the legal language that is at the top of the page.
bhenry
New php-forum User
New php-forum User
 
Posts: 5
Joined: Thu Feb 02, 2006 9:08 am

Postby Coditor » Tue Feb 07, 2006 12:45 pm

If you really want to send the exact page, I suggest you use this:

Code: Select all
<?php
ob_start();
?>
<html>
<body>
Build your page here...
</body>
</html>
<?php
$pageContent = ob_get_clean();
echo $pageContent;
mail("me@myemail.com", "form submit", $pageContent, "Content-type: text/html\n");
?>
Coditor
New php-forum User
New php-forum User
 
Posts: 243
Joined: Wed Feb 01, 2006 9:18 am
Location: Netherlands

Postby bhenry » Tue Feb 07, 2006 1:10 pm

Coditor- Where would I put the submit button? Do i change the form action to mailto?
bhenry
New php-forum User
New php-forum User
 
Posts: 5
Joined: Thu Feb 02, 2006 9:08 am

Postby Coditor » Tue Feb 07, 2006 1:58 pm

This would work without a submit button. It would e-mail the data to you as soon as the user sees the resultpage.

If you really want to use a submit button, add hidden fields for all the data and an extra hidden field (eg <input type="hidden" name="printthis" value="yes" />) and submit again to the same page as you are.

Change line 13 to:
Code: Select all
if (isset(_POST{"printthis"}) && _POST{"printthis"} == "yes") {
   mail("me@myemail.com", "form submit", $pageContent, "Content-type: text/html\n");
}
Coditor
New php-forum User
New php-forum User
 
Posts: 243
Joined: Wed Feb 01, 2006 9:18 am
Location: Netherlands


Return to PHP coding => Mail

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.