Jump to content

Parse error: syntax error, unexpected T_VARIABLE in C:\xampp\htdocs\abhs\send_s


strujillo

Recommended Posts

please help i cant figure out where the heck this is coming from im about to go crazy here...*cry cry*

 

<?
//This code checks to make sure they are logged in BEFORE they can access the webpage
session_start();
if(!isset($_SESSION['myusername'])){
//If he is not logged in, go to index.php
header("location:index.php");
}else{
//If he is logged in do nothing and go on to the rest of the code.
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Send Status</title>
</head>

<body>

<?php
//Includes header file
include("header.php");


?>


<div id="Mbody">

<?php
//declares database variables
$host="localhost"; // Host name
$username="root"; // Mysql username
$password=""; // Mysql password
$db_name="abhs"; // Database name

// Connect to server and select database.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");

$sendto=$_POST['sendto'];

//inserts the data into the database. ERROR IS PRODUCED HERE FOR SOME REASON???  HERE IS WHAT THE ERROR SAYS.
//Parse error: syntax error, unexpected T_STRING in C:\xampp\htdocs\abhs\send_success.php on line 43
$sql='INSERT INTO `abhs`.`messages` (`to` ,`from` ,`subject` ,`message` ) VALUES ( 
'$_POST['sendto']';  
'$_SESSION['myusername']',  
'$_POST['subject']',  
'$_POST['message']' )';

$result=mysql_query($sql);

if($result){
echo "Successful<BR>";
echo "<a href=members_home.php>View your topic</a>";
}
else {
echo "ERROR";
}
?>


</div>

</body>
</html>

usually unexpected T_VARIABLE means that you forgot a semicolon wherever you started a variable at......

that error code should tell you a line number

above that line number......you probably forgot the semicolon

or put one where there shouldn't have been

  Quote

look at my post on you other post WITH THE SAME EXACT PROBLEM DON'T POST TWICE

 

Scott.

 

JEEZ, sorry scott, lol. ok so i did what you told me to but it fixed the parse error. but no for some reason it doesnt put the information INTO the database.

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.