Hi everyone,
I'm acquainting myself with php - and am running into problems with some code. I've been looking at it for hours, and surfing the web for answers with no progess - can you help?
I am receiving this error message:
Parse error: parse error, unexpected T_VARIABLE in /homepages/23/d168427155/htdocs/userinfo.php on line 34
...when i am trying to run this code:
<?
$ip = getenv('REMOTE_ADDR');
$time = date('D M j');
if(isset($_POST['commented']))
{
// Tell the user it has been submitted (optional)
echo('Your comment has been posted.');
// Set Mysql Variables
$host = 'myhost;
$user = 'myusername';
$pass = 'mypass';
$db = 'mydb';
$table = 'Student Users';
// Set global variables to easier names
$first = $POST['StudentUsers_firstName'];
$last = $POST['StudentUsers_lastName'];
$school = $POST['StudentUsers_school'];
$gradyear = $POST['StudentUsers_year'];
$gpa = $POST['StudentUsers_gpa'];
$address = $POST['StudentUsers_address'];
$city = $POST['StudentUsers_city'];
$state = $POST['StudentUsers_state'];
$zip = $_POST['StudentUsers_zip'];
// Connect to Mysql, select the correct database, and run the query which adds the data gathered from the form into the database
mysql_connect($host,$user,$pass) or die(mysql_error());
mysql_select_db($db) or die(mysql_error());
$add_all = 'INSERT INTO $table VALUES ('$first','$last','$school','$gradyear','$gpa','$address','$city','$state','$zip)';
mysql_query($add_all) or die(mysql_error());
}
else
{
// If the form has not been submitted, display it!
?>
The above php file was a part of a script that included html - but I was running into php_self errors, so I decided to separate them.
Also, I don't need the $ip and $time for now - so that can be erased...
Any advice would be wonderful!
Thanks,
SsidellQ