Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I am getting Parse error: syntax error, unexpected '.' in C:\xampp\htdocs\PHPExercise\go4shop\header.php as
php require("bar.php");
echo "<hr />";
if (isset($_SESSION['SESS_LOGGEDIN']) == T RUE) {
echo "Logged in as <strong>".$_SESSION['SESS_USERNAME']."</strong>[<a href=" & quot;.$config_basedir. & quot;
logout.php ">logout</a>]";
} else {
echo "<a href=" & quot;.$config_basedir. & quot;
login.php ">Login</a>";
}
Rewrite your code. Use the below code:
php require("bar.php");
echo "<hr/>";
if (isset($_SESSION['SESS_LOGGEDIN'])) {
echo "Logged in as <strong>".$_SESSION['SESS_USERNAME']."</strong>[<a href='".$config_basedir."logout.php'>logout</a>]";
} else {
echo "<a href='".$config_basedir."login.php'>Login</a>";
}
Remove the " from the code. And make the code workable.
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
echo "<td> <a href='#'>" Add to cart "</a></td>";
Error:
Parse error: syntax error, unexpected T_STRING, expecting ',' or ';'
in C:\xampp\htdocs\merchant e link\index1.php on line 30
<?php
echo "<td> <a href='#'> Add to cart </a></td>";
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
Need a hand..i am getting following error :
Parse error: syntax error, unexpected '<' in C:\xampp\htdocs\site\html_purple\design_your_own_card.php on line 213
while line number 213 is :
<?php <img id='image1' src='http://localhost/uploader/".$fulltarget."' width='280px' height='180px'/> ?>
You are mixing php and HTML.
Try this..
<?php echo "<img id='image1' src='http://localhost/uploader/".$fulltarget."' width='280px' height='180px'/>"; ?>
OR just wrap your php variables in php tags..
<img id='image1' src='http://localhost/uploader/<?= $fulltarget ?>' width='280px' height='180px'/>
You cant wrap html in php, you need to echo or print it out
<?php print "<img id='image1' src='http://localhost/uploader/".$fulltarget."' width='280px' height='180px'/>"; ?>
OR
<?php echo "<img id='image1' src='http://localhost/uploader/".$fulltarget."' width='280px' height='180px'/>"; ?>
You have html wrapped in PHP.
Try
echo "<html code>";
Or my personal favourite. Only wrap your variables in php tags.
<img id='image1' src='http://localhost/uploader/"<? echo $fulltarget; ?> width='280px' height='180px'/>
This will only work with short tags enabled in config.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 8 years ago.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Improve this question
Here is my code. I'm new to php and just trying to edit a page using Kompozer. When I published the site back to the ftp server this error suddenly appeared on the page. Odd since I didn't even touch this code. (I have since touched the below code trying to fix it). Any help fixing this code would be much appreciated.
<?php
if(isset($_SESSION["pkg_error"]))
?>
<div class="error_msg_cont">
<?php
foreach($_SESSION["pkg_error"] as $error)
{
echo $error. "<br>"
}
?></div>
<?php
if(isset($_SESSION["msg"]))
{
echo '<div class="error_msg_cont">'. $_SESSION["msg"] .'<div>'
}
?>
On these two lines:
echo $error. "<br>" }
echo '<div class="error_msg_cont">'. $_SESSION["msg"] .'<div>' }
You need a semicolon before the closing }.
Closing a PHP code block (?>) implies a semicolon, but closing a block of code within a PHP code block (}) does not.
you missed ; on :
echo $error. "<br>" }
and
echo '<div class="error_msg_cont">'. $_SESSION["msg"] .'<div>' }
Actually, the error is self-explained.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
hi i want to start a session of user but i am unable to do that. i have see examples of it also but my problem is still the same. i am getting this error
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/a2277283/public_html/scripts/login.php on line 11
here is my code
<?php
ob_start();
session_start();
include 'db.php';
if (isset($_POST['submit'])) {
echo $email = $_POST['user_email'];
$sql = "select * from user where `user_email` = '$email'";
if (mysql_query($sql)) {
$_SESSION['email'] = $email;
echo "$_SESSION['email']";
}
}
?>
the problem is:
echo "$_SESSION['email']";
Use without quotes like:
echo $_SESSION['email'];
or
echo "$_SESSION[email]";
or
echo "{$_SESSION['email']}";
Echo the session variable like this: echo "{$_SESSION['email']}"; as described at the PHP Docs
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
The simple program is not returning the string,Please help.
<?php
function returnStr() {
return "fooBar";
}
$str=returnStr();
echo $str;
}
?>
It's a parse error:
$str=returnStr();
echo $str;
} // WHAT IS THIS BRACKET DOING HERE?
There's a fatal error tokenizing the code due the trailing/unmatched '}' remove that and the code will work. Then spend some time thinking about why you didn't know this already
There's an error in your code. The last } is useless.