liam Posted August 24, 2008 Share Posted August 24, 2008 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 More sharing options...
zq29 Posted August 26, 2008 Share Posted August 26, 2008 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 https://forums.phpfreaks.com/topic/121092-session-info-to-mysql-via-form/#findComment-626292 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.