PhPots Posted October 12, 2014 Share Posted October 12, 2014 Hello guy , how do I write PHP page that have table to list all the data I entered to my system. Link to comment https://forums.phpfreaks.com/topic/291585-how-do-i-create-page-to-display-data-i-entered/ Share on other sites More sharing options...
Frank_b Posted October 12, 2014 Share Posted October 12, 2014 Hi, That is a very global question. Can you explain what you system is? are you talking about a database, a textfile or what? Link to comment https://forums.phpfreaks.com/topic/291585-how-do-i-create-page-to-display-data-i-entered/#findComment-1493380 Share on other sites More sharing options...
PhPots Posted October 12, 2014 Author Share Posted October 12, 2014 @frank_b Its a php system with sql database. I entered student information into the system. I can view the student info by knowing their ID. But I want to create page that list student that I registered. Now I can only view student list through PHPmyadmin. Link to comment https://forums.phpfreaks.com/topic/291585-how-do-i-create-page-to-display-data-i-entered/#findComment-1493385 Share on other sites More sharing options...
ginerjm Posted October 12, 2014 Share Posted October 12, 2014 Basically you want to write some code like this: if $_POST['id'] is not set, output a form that has one text field for the id and one submit that calls back to this script using POST, not GET when it is submitted and exit and wait for the input. if $_POST['id'] is set, then grab it, validate it, and use it in a prepared query to get the data you want to display. Using those query results ($pdo->fetch(PDO::FETCH_ASSOC) ) build some html to display these fields in whatever order you want. You can use an html table, or some div tags to arrange it on screen. Be sure to place some submit buttons on it to handle what ever you want to do next. Then exit and wait. This is a very simple solution. You need to be safe and secure in handling the user input and writing the query. Link to comment https://forums.phpfreaks.com/topic/291585-how-do-i-create-page-to-display-data-i-entered/#findComment-1493393 Share on other sites More sharing options...
Frank_b Posted October 12, 2014 Share Posted October 12, 2014 take a look here: http://webdevelopingcat.com/php-mysql-tutorial-for-beginners-connecting-to-the-database-with-pdo/ Link to comment https://forums.phpfreaks.com/topic/291585-how-do-i-create-page-to-display-data-i-entered/#findComment-1493420 Share on other sites More sharing options...
PhPots Posted October 13, 2014 Author Share Posted October 13, 2014 Nicely done. Thank you guys ! Link to comment https://forums.phpfreaks.com/topic/291585-how-do-i-create-page-to-display-data-i-entered/#findComment-1493433 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.