Jump to content

session info to mysql via form


liam

Recommended Posts

hi

I am new to php / mysql and Im learning as I go. I have ran into a problem. I have a login script that creates a session when logged in. I can use the members name on the page by typing

 

<?php echo "Hello there, {$_SESSION['name']}! Welcome to my site!"; ?>

 

What Id like is once a user logs in they use a form to submit data to the database. But id also like their name from the session to be stored with any entries, but without them being able to manipulate it.

 

I found this

$result = mysql_query("INSERT INTO TABLE SET id='".$_SESSION['name']."'") or die('Could not commit insert.');

 

and this puts the session name into the database but i cannot get it to work in conjunction with a regular form that I made using a tutorial found here:

http://www.spoono.com/php/tutorials/upload/add.txt

 

Can somebody please point out what id need to do?

Any more questions please ask

 

Thanks for your time

Liam

Link to comment
Share on other sites

If you post up your code so far, we might be able to help you out a little easier. As a side note, it would make a lot more sense to store the users id rather than their name - A users name is generally not considered unique!

Link to comment
Share on other sites

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.