Jump to content

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


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

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.