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
https://forums.phpfreaks.com/topic/121092-session-info-to-mysql-via-form/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.