Jump to content

saving a report to a MySql database


alantony

Recommended Posts

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"> &nbsp
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
Share on other sites

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
Share on other sites

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.