I need help. I am trying to carry 1 variable (username) from the login page to another. First of all, am I writing this code correctly?
session_start();
$_SESSION["$user_username"] = "username";
$user_username is the variable I use from the login script on the login page which equals username (form field)
username is equal to form field from the login.
Then once I register this, does it have to be on every page? Also, if I want to call it up as a GET on the next page, can I do that?
Trying to write a query as well.
// Connect to the database
$dbc = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
$query = "SELECT * FROM casesubmission WHERE username=+$user_username";
$result = mysqli_query($dbc, $query)
or die ('Error Querying Database.');
$row = mysqli_fetch_array($result);
echo $row['city'];
what am I doing wrong. This may be the code for an actual manual query. I am trying to pull up information on the main menu after login using the username from login page. The form refers to itself and the form is POST on the login and somehow I need a GET as well. Any Suggestions?
session_start();
$_SESSION["$user_username"] = "username";
$user_username is the variable I use from the login script on the login page which equals username (form field)
username is equal to form field from the login.
Then once I register this, does it have to be on every page? Also, if I want to call it up as a GET on the next page, can I do that?
Trying to write a query as well.
// Connect to the database
$dbc = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
$query = "SELECT * FROM casesubmission WHERE username=+$user_username";
$result = mysqli_query($dbc, $query)
or die ('Error Querying Database.');
$row = mysqli_fetch_array($result);
echo $row['city'];
what am I doing wrong. This may be the code for an actual manual query. I am trying to pull up information on the main menu after login using the username from login page. The form refers to itself and the form is POST on the login and somehow I need a GET as well. Any Suggestions?