jassikundi Posted February 7, 2008 Share Posted February 7, 2008 Hi everyone, I've created a login system when users login they have the option to submit an online quote. I've created the database to capture the data, everything works fine apart from capturing the username of the person logged in. My quote page uses this method to retrieve the username of the person logged in and displays it fine. <? include("../include/session.php"); ?> <h1>User Account Edit : <? echo $session->username ?></h1> This is displaying the username of the person logged in: I'm using the post method to then process the quote form. How would I capture this and send it to my database? At the moment I'm trying the following: //Get username of person logged in $session->username=$_POST['username']; //Send username to database mysql_query("INSERT INTO `contracts` VALUES (''$username')") ; Can someone advise me what I'm doing wrong? Also i'm not sure if I had to include include("../include/session.php"); to the process page but it gave me an error so im guessing its not required as it stops any data from being stored to the database. Regards Jassi Quote Link to comment https://forums.phpfreaks.com/topic/89915-capturing-username-session-to-database/ Share on other sites More sharing options...
trq Posted February 7, 2008 Share Posted February 7, 2008 In your short snippet, you don't define the $username variable your using within your query. Also, assuming the ../include/session.php file holds the definition for the $session class, yes, you will need to include it. Quote Link to comment https://forums.phpfreaks.com/topic/89915-capturing-username-session-to-database/#findComment-460935 Share on other sites More sharing options...
jassikundi Posted February 7, 2008 Author Share Posted February 7, 2008 Hi Thorpe can you elaborate any further what would I need to do inorder for me to capture the data and post it? I dont quite understand what your saying by "you don't define the $username variable your using within your query". Thanks for the help. Quote Link to comment https://forums.phpfreaks.com/topic/89915-capturing-username-session-to-database/#findComment-460958 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.