Jump to content

How do I create page to display data I entered


PhPots

Recommended Posts

@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.

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.