Question: How do I retrieve values from mysql database from current session or based on username? Trying to create a mostly pre-populated html form with values
How do I retrieve values from mysql database from current session or based on username?

Trying to create a mostly pre-populated html form with values based on the ones already in database. If the database does not yet have a value for it, I want it to print out such (e.g. "Empty!")
For the username slot, I was able to pre-populate the field using value="" However when I try that with email I get an error. Here is the php I'm using in the file.



Some data was already input from user registration page. Such as Username, and E-mail. But I would like the available data to populate and if not available echo empty!. I also need the data submitted to be able to be input into the database. For example address, first name, and last name. Which was not input by the user on the registration page. Form looks like this:
Table "users" for Database ucast. All of the information populated is from registration. Once logged in they should see pre-populated data from the database relative to their account with the option to upgrade non-readonly fields. If the database doesn't have anything for that field, I would like it to echo a statement saying such.

Right now when I try to echo the Email is html value=" " it just shows the error above in that field.
Email
Notice: Undefined variable: email in Z:\xampp\htdocs\Cast\dashboard.pl db.php 1 2 3 dashboard.php auth_session.php
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
