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.
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
I am new to PHP and I am using PHP Version 5.4.17 in my mac. Below code with space gives me error. Once I remove the space in echo command, it gives me output but appended with Junk character. What am I doing wrong? Any help is appreciated
Code:
<?php
echo “Connection Success”;
?>
Error:
"Parse error: parse error, expecting ','' or';'' in /Library/WebServer/Documents/test org.php on line 2"
Code:
<?php
echo “ConnectionSuccess”;
?>
Output:
“ConnectionSuccessâ€
<?php
echo "ConnectionSuccess";
?>
You need to remove the bad quotes “ and ” and replace them with standard quotes: "
Some editors do this for you automatically, like BareBones.
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 have the PHP code as below:
<?php
echo "<tr></tr>";
//ouput I want : <tr></tr>
?>
When Output I want to display <tr></tr>.But I don know whitch function that I should use for this,anyone know help me please,thanks
Try with htmlentities like
<?php
echo htmlentities("<tr></tr>");
?>
Follow this LINK
You can also make use of htmlentities()
<?php
echo htmlentities("<tr></tr>");
?>
Try this
$output = htmlspecialchars("<tr></tr>", ENT_QUOTES);
Use htmlentities
<?php
echo htmlspecialchars('<tr></tr>');
?>
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.
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
Following code gives me the error.
<?php
echo "<a href='prefs.php?username=$PHP_USER'>$lang_menu["prefs"]</a>";
?>
I'm pretty sure it has something to do with me requesting 2 php variables, no idea how to solve.
Replace with
<?php
echo "<a href='prefs.php?username=".$PHP_USER."'>".$lang_menu['prefs']."</a>";
?>
Obviously, you cannot write unescaped double quotes in a double-quoted string. And I'd advise against writing unescaped text into HTML and URLs. Try this:
<?php
echo '' . htmlspecialchars($lang_menu["prefs"]) . '';
?>
Edit: A couple of clarifications...
These are valid strings:
$foo = "Hello, World!";
$foo = "Hello, 'World!'";
$foo = "Hello, \"World!\"";
This is not:
$foo = "Hello, "World!"";
SQL injection, as the word suggests, refers to the database query language called SQL. This code does not contain SQL and it does not interact at all with any database.
So it's nothing about dots or SQL injection. It's about certain characters that have a special meaning in certain semantic contexts. It's about text within text.
$variables splitted with quotes " :
echo "<a href='prefs.php?username=".$PHP_USER."'>".$lang_menu['prefs']."</a>";
Use this:
<?php
echo "<a href=\"prefs.php?username=".$PHP_USER."\" >".$lang_menu["prefs"]."</a>";
?>
Try this
<?php
echo "<a href='prefs.php?username=".$PHP_USER."'>".$lang_menu['prefs']."</a>";
?>
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.