alantony Posted May 16, 2008 Share Posted May 16, 2008 Hi, I have a simple form with a few fields <p><b> TFESI </b> </p> <form method="POST" action="../templates/template.show.php" name="tfesi"> <hr noshade="noshade" size="3" /> Lastname: <input type="text" size="25" name="lastname">   Firstname: <input type="text" size="25" name="firstname"><br> that I send to a processing php file: $lastname=$_POST['lastname']; $firstname=$_POST['firstname']; <div id="demographic"> <p class="content"> <b>Patient </b> <b> <?php echo "$lastname".","."$firstname" ?> </b> <br> present with a headache. The managers want to save the html output (report) to a MySQL table. is this possible? HOw if possible? much thanks Link to comment https://forums.phpfreaks.com/topic/105856-saving-a-report-to-a-mysql-database/ Share on other sites More sharing options...
p2grace Posted May 16, 2008 Share Posted May 16, 2008 What do you mean they want to save the output? Do you want to save the variables entered into the form, or the actual html that is shown to the users after registering? Link to comment https://forums.phpfreaks.com/topic/105856-saving-a-report-to-a-mysql-database/#findComment-542555 Share on other sites More sharing options...
alantony Posted May 16, 2008 Author Share Posted May 16, 2008 not the variables-that would be cake the html output that users view. thanks again. Link to comment https://forums.phpfreaks.com/topic/105856-saving-a-report-to-a-mysql-database/#findComment-542587 Share on other sites More sharing options...
cooldude832 Posted May 16, 2008 Share Posted May 16, 2008 thats not how a database is meant to be used. Variables go into it to be reused later on in "new" forms. If you want to form as some sort of preservation of the user's view for record storing i'd suggest presenting the user with a pdf instead (better for printing also) and then store the binaries of the developed pdf in the database. Link to comment https://forums.phpfreaks.com/topic/105856-saving-a-report-to-a-mysql-database/#findComment-542604 Share on other sites More sharing options...
Rebelrebellious Posted May 16, 2008 Share Posted May 16, 2008 Since they can't see the database, couldn't you save the html with the variables assigned then redisplay it when you need it with a browser? $dynamiccontent = whatever; $page = ''; $page .= '<exampletag>Some whatnot</exampletag>'; $page .= $dynamiccontent; $page .= <morehtml>...</morehtml> echo $page; $query = "INSERT INTO `yourtable` (`pagedisplay`) VALUES ('$PAGE')"; $result = mysql_query($query); die() Link to comment https://forums.phpfreaks.com/topic/105856-saving-a-report-to-a-mysql-database/#findComment-542689 Share on other sites More sharing options...
alantony Posted May 16, 2008 Author Share Posted May 16, 2008 So i wasn't exactly clear. I got this to work finally thnks to the nudge by the last post. amazing things happen at 3am ;-) $output_to_browser=<<<END <html> html stuff and $_POST['from form'] </html> END; echo $output_to_browser; $SQL=INSERT INTO db.report (id, report) VALUES ('id', '$output_to_browser'); This allowed the html output to browser to be saved in the mysql database. I have also been able to post the report by pulling the report out of the database. thanks rebelrebellious. I like your way a little better. thanks again for your help. Link to comment https://forums.phpfreaks.com/topic/105856-saving-a-report-to-a-mysql-database/#findComment-542788 Share on other sites More sharing options...
Rebelrebellious Posted May 16, 2008 Share Posted May 16, 2008 I'm happy to help. Link to comment https://forums.phpfreaks.com/topic/105856-saving-a-report-to-a-mysql-database/#findComment-543078 Share on other sites More sharing options...
DarkWater Posted May 16, 2008 Share Posted May 16, 2008 Use ob_start();, and use ob_flush(); when you want to display the output, and ob_get_contents(); to assign the buffer to a variable. Link to comment https://forums.phpfreaks.com/topic/105856-saving-a-report-to-a-mysql-database/#findComment-543114 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.