Jump to content

help calling some information from a session


jacko_162

Recommended Posts

when a user is logged onto my test site i can echo the following;

 

<?php echo $_SESSION['SESS_MEMBER_ID'];?>

 

i have a new table in my database that i want users to use to add certain data specs but i want the form to include the above "member id"

 

for some reason i cant get it to work as i get all types of syntax errors thrown up in the browser.

 

 

this is my form code:

 

<form action="<?=$_SERVER['PHP_SELF']?>" method="post">
						<?php 
if (isset($_POST['submit'])) {

$insert = "INSERT INTO $table1 SET 
member_id='NEED TO INSERT MEMBER ID HERE', 
test1='$test1', 
test2='$test2',
test3='$test3',
test4='$test4',
test5='$test5',
test6='$test6',
test7='$test7',
test8='$test8',
test9='$test9',
test10='$test10',
test11='$test11',
test12='$test12',
test13='$test13',
test14='$test14',
date=NOW(), 
time=NOW()"; 

if (@mysql_query($insert)) { 
echo('<div class="msg msg-ok"><p>This item was added successfully</p></div>'); } 
else { 
echo('<div class="msg msg-error"><p><strong>oops!</strong> something went wrong, please try again!</p></div>'); 
}} 

?>

 

how can i put in the session variable into the table, or how do i change;

 

<?php echo $_SESSION['SESS_MEMBER_ID'];?>

 

to;

 

<?php $member_id ?>

 

i can then call "$member_id" in other templates if needed.

 

many thanks for any help :)

 

steve

yes i start the seesion at the top of every page.

 

the problem isnt with the code i have at the moment, i didnt explain myself very well :(

 

ok i wanted to use the session call to insert the result into a table (see php form code above)

 

to do this i want to define $member_id as $_SESSION['SESS_MEMBER_ID'];

 

so i can insert the result into a seperate table in the database.

 

my head hurts :(

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.