Link to home
Start Free TrialLog in
Avatar of jseaman12
jseaman12

asked on

PHP Insert of session variable

I have a form that collects data from the end user inputting the data. I also have a session script to check if the end user logged in so that the page will display or forward them somewhere else.

The form page will go to a INSERT.php which inserts the form variables into the database. What I need to do is INSERT the session variable which is the username into the database. But I'm getting an error message.

Here is the error message;

Parse error: syntax error, unexpected ',' in /home2/thstew/public_html/insert.php on line 17

Now if I run the same POST Variables without the session variable it works.


Thanks,
Jeff
/// This code is the session variable on the form page// 
<?php
 
 
//Start session
session_start();
//Check whether the session variable
//SESS_MEMBER_ID is present or not
if(!isset($_SESSION['SESS_MEMBER_ID']) || (trim($_SESSION['SESS_MEMBER_ID'])=='')) {
header("location: http://www.google.com");
exit();
}
 
?>
 
//This code is the INSERT STATEMENT //
 $sql="INSERT INTO oetable_backup(entry_date,territory,principle,customer,po,part_no,qty,initial_sale,due_to_ship,comm,type_ind,location_ind)
VALUES
('$_POST[entry_date]','$_POST[territory]','$_POST[principle]','$_POST[customer]','$_POST[po]','$_POST[part_no]','$_POST[qty]','$_POST[initial_sale]','$_POST[due_to_ship]','$_POST[comm]','O','$_POST[SESS_MEMBER_ID]')";

Open in new window

SOLUTION
Avatar of syedasimmeesaq
syedasimmeesaq
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jseaman12
jseaman12

ASKER

I've tried that one before and receive the same error message. So that doesn't work.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I didn't get the answer I needed but that's ok. Thanks for your help and support.