olly79 Posted February 6, 2009 Share Posted February 6, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/144125-displaying-mysql-data-on-a-web-page/ Share on other sites More sharing options...
Maq Posted February 6, 2009 Share Posted February 6, 2009 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... Quote Link to comment https://forums.phpfreaks.com/topic/144125-displaying-mysql-data-on-a-web-page/#findComment-756241 Share on other sites More sharing options...
olly79 Posted February 6, 2009 Author Share Posted February 6, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/144125-displaying-mysql-data-on-a-web-page/#findComment-756252 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.