Jump to content

Recommended Posts

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

 

Link to comment
https://forums.phpfreaks.com/topic/89915-capturing-username-session-to-database/
Share on other sites

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.

;)

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.