Search the Community
Showing results for tags 'php $session'.
Found 1 result
Hi, i ve created an app which works fine while iam the admin. I now want to create users ( i have dummy users in the practice app and all foreign keys work fine) I ve just set up a log in system for users and using $session, which sounds standard from the many tutorials i ve learnt from. But after the log in system all tutorials seem to go dead. Anyway my next step is to allow a user who had logged in ( who by signing up has entered into a 'users' table in MySQL with a unique id) i now want them to fill out forms which will input into table 'firsts'.. Which has the foreign key of their id. am i missing something..how do tell the database to populate the form using the users id. Is it common practice to use $_SESSION['usr_id'] or do i get the users id some other way..i cant work it out for some reason... thanks heres what i have so far .. .not sanitized yet etc session_start();. ????? [user id] $client_title =$_POST['client_title']; $client_name =$_POST['client_name']; $client_contact =$_POST['client_contact']; $client_email =$_POST['client_email']; $notes =$_POST['notes']; $sql = "INSERT INTO firsts (usr_id, client_title, client_name, client_contact, client_email, notes ) VALUES ('$usr_id', '$client_title' , '$client_name' ,'$client_contact' ,'$client_email' ,'$notes' )"; $result = mysqli_query($conn,$sql);