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.

Link to comment
Share on other sites

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
Share on other sites

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.