How can I save the user Id when is filling a form using PHP (Sessions)?? I mean how do get this session and I write the SQL query to save the uder ID in the form that has been submitted...
This is my session
session_start();
$_SESSION['user_id'] = $data['user_id'];
$_SESSION['first_name'] = $data['first_name'];
and here when the user log in to fill the form
session_start();
if (!isset($_SESSION['agent']) OR ($_SESSION['agent'] != md5($_SERVER['HTTP_USER_AGENT']) )) {
// Need the functions:
require ('includes/login_functions.inc.php');
redirect_user();
// Print a message:
}
echo "<span>You are now logged in, {$_SESSION['first_name']}!<a href=\"logout.php\">Logout</a></p></span>";