garyed Posted August 12, 2012 Share Posted August 12, 2012 I know how to do an email script so I assume I could email a file without a problem but I want to email a web page. Currently I have a php page where the user enters a bunch of data in a form & the form prints the results to the screen. I use a javascript window.print() function so the user can print the page. I want to be able to have the user hit a button & email the same output that the javascript function will print. I assume I would have to print the page to a file & then have that file emailed but how can the page be printed to a file? Am I even thinking on the right track? Quote Link to comment https://forums.phpfreaks.com/topic/266991-can-i-email-a-web-page-through-php/ Share on other sites More sharing options...
Christian F. Posted August 13, 2012 Share Posted August 13, 2012 The question that hits me is "why?" Why would you e-mail the page, when you can just send a link to it? Quote Link to comment https://forums.phpfreaks.com/topic/266991-can-i-email-a-web-page-through-php/#findComment-1368983 Share on other sites More sharing options...
GD77 Posted August 13, 2012 Share Posted August 13, 2012 trying to achieve a newsletter layout? as been said just generate the page and email it as link or use phpmailer to email the whole page yet it wil be big so emailing the link like a newsletter will be wiser. Quote Link to comment https://forums.phpfreaks.com/topic/266991-can-i-email-a-web-page-through-php/#findComment-1368997 Share on other sites More sharing options...
Barand Posted August 13, 2012 Share Posted August 13, 2012 Before you can mail a link to a page you need a page that can be linked to. So you either have to save the screen output as a static HTML file or store the inputted data and email a link to a php script that can recreate the HTML page from that data. Quote Link to comment https://forums.phpfreaks.com/topic/266991-can-i-email-a-web-page-through-php/#findComment-1369007 Share on other sites More sharing options...
garyed Posted August 14, 2012 Author Share Posted August 14, 2012 Maybe I didn't make myself very clear. The page where the form is filled out remains as is & the data entered into the form produces additional output on the page. A link to the page would be useless because all the data & inputs are gone when you leave the page. Quote Link to comment https://forums.phpfreaks.com/topic/266991-can-i-email-a-web-page-through-php/#findComment-1369193 Share on other sites More sharing options...
Christian F. Posted August 14, 2012 Share Posted August 14, 2012 In that case I'd use a database to store the data, and use an ID to retrieve it again. Then send a link with the given ID, and you're set. Quote Link to comment https://forums.phpfreaks.com/topic/266991-can-i-email-a-web-page-through-php/#findComment-1369194 Share on other sites More sharing options...
garyed Posted August 14, 2012 Author Share Posted August 14, 2012 In that case I'd use a database to store the data, and use an ID to retrieve it again. Then send a link with the given ID, and you're set. That sounds like a good idea if I can figure out how to do it. I'll try & work on it. Thanks for the idea. Quote Link to comment https://forums.phpfreaks.com/topic/266991-can-i-email-a-web-page-through-php/#findComment-1369218 Share on other sites More sharing options...
Christian F. Posted August 14, 2012 Share Posted August 14, 2012 You're welcome, glad I could help. I've also found you a starting point PHP & MySQLi tutorials, which should help explain how to communicate against a database. I also recommend looking at a MySQL tutorial, to learn how to use a database (and not just how to use PHP to communicate with it). Quote Link to comment https://forums.phpfreaks.com/topic/266991-can-i-email-a-web-page-through-php/#findComment-1369294 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.