Jump to content

Recommended Posts

Hi all,

 

Just wondering if anyone can help me with the following:

 

I'm inserting data from a web form into MySQL and I would now like to display that data from MySQL onto a webpage. I would then like to create a "Load Data" button and "Export Data" button which would then output the data to .csv

 

I'm not sure on the best approach based on the information I'm inserting. Below is a sample of the data that I'm sending from the web form:

 

empty($_POST['name']) ? $name='' : $name = $_POST['name'];

empty($_POST['surname']) ? $surname='' : $surname = $_POST['surname'];

empty($_POST['address']) ? $address='' : $address = $_POST['address'];

empty($_POST['city']) ? $city='' : $city = $_POST['city'];

empty($_POST['zip']) ? $zip='' : $zip = $_POST['zip'];

empty($_POST['state']) ? $state='' : $state = $_POST['state'];

empty($_POST['day_ph']) ? $day_ph='' : $day_ph = $_POST['day_ph'];

empty($_POST['mob_ph']) ? $mob_ph='' : $mob_ph = $_POST['mob_ph'];

empty($_POST['email']) ? $email='' : $email = $_POST['email'];

empty($_POST['add_info']) ? $add_info='' : $add_info = $_POST['add_info'];

 

Would I be best to insert the data into a HTML tabular table? Or could I use a display window for the data with scroll bars. My question would then be, could I export to .csv if I displayed the data in such a way?

 

Any thoughts, examples or input would be much appreciated.

Link to comment
https://forums.phpfreaks.com/topic/144125-displaying-mysql-data-on-a-web-page/
Share on other sites

Here's an easier format for ternaries, which is really the point of them.

 

$name = empty($_POST['name']) ? '' : $_POST['name'];

 

 

Would I be best to insert the data into a HTML tabular table? Or could I use a display window for the data with scroll bars. My question would then be, could I export to .csv if I displayed the data in such a way?

 

Doesn't matter how you display it.  You can use the same variables and data to put in the CSV file.  Maybe I'm misunderstanding but your question seems unclear to me...

Hi,

 

Sorry, basically I'm wondering how best to display the data.

 

I guess I would like on big window on the web page which would show all the data from the DB i.e.

 

Name ¦ Surname ¦ Address ¦ Postcode ¦

John

Peter

Paul

Michael

 

Then underneath this I would have a "Import" button which would load the DB data into the window for view and then an "Export" buttton which would allow me to export the data to .CSV

 

So, I'm looking for help in terms of how best to create the window to display the data (HTML table driven by CSS, or a Box) and then how to tab the DB data within the window?

 

Thanks

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.