Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Use data to Populate DB Tables and Another Form in PHP

Posted on 2013-06-25
5
Medium Priority
?
191 Views
Last Modified: 2013-06-26
I have a form that uses PHP to populate tables in a database. I want to use the same data to populate a printable form at the same time the tables are populated. I want this to be one step for users. When they click the "submit" button, I want the data sent to the database and to the printable form.

I am in the process of creating the printable form in the same php file I sent the data to the database. Is this the best way or is there a better way? If there is a better way, please give me some tips. Thanks in advance.
0
Comment
Question by:wayneray
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 84

Accepted Solution

by:
Dave Baldwin earned 1000 total points
ID: 39276859
That's pretty much the only way because that's when you have the data available to you.  I suppose you could retrieve it back from the database but that would take a little longer and it would still be the data you already have.  

I am about to do one that way but that's partly because I need to be able to display it later also.  So I'm going to create the printable form, send a copy to my customer and save a copy in the database.  That allows my customer to display it to their customer if and when they need to.
0
 

Author Comment

by:wayneray
ID: 39277671
Which is easier, populate the printable form first then send data to the database or does it matter?
0
 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 39278904
It doesn't matter except that if you are calculating or generating some data, you have to do that before you can use it.  I would normally assign POST data to variables and do any filtering needed, do all the calculations that were needed, create the email or document, email it, and then put it in the database for later use. The last two, email and database are usually interchangeable because you have already made all the changes to the data by then.
0
 

Author Closing Comment

by:wayneray
ID: 39278937
Thanks for your help. I asked a stupid question this morning. Not awake I guess. All is working fine. I have to submit to the database first to get info needed to populate other tables.
0
 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 39278999
You're welcome, glad to help and thanks for the points.
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn how to dynamically set the form action using jQuery.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question