This question already has answers here:
PHP parse/syntax errors; and how to solve them
(20 answers)
Closed 7 years ago.
i get the error on the line 2, below
don't know why ... seems fine to me ... i've tried numerous ways of doing it, but the same error comes up
any ideas ?
Any help would be much appreciated ...
Basically i have an input box with a submit button and whats submitted into the box is then printed on the same page, right under the submit box.
The code is fine when i remove the html tags. don't understand why, but it happens ...
echo "<h2>Input:</h2>";
echo . "<div class='blank'>".$convert."</div>" ;
Remove the . before the start of your string. That will fix it.
echo "<h2>Input:</h2>";
echo "<div class='blank'>".$convert."</div>";
Related
This question already has answers here:
PHP parse/syntax errors; and how to solve them
(20 answers)
Closed 2 years ago.
Hi I was told to put the following code into my footer PHP
<?php echo do_shortcode("[wpgmza id="1"]"); ?>
My acutal code:
<div class="col-lg-8"><?php echo do_shortcode("[wpgmza id="1"]"); ?> </div>
Im getting the following Error:
Your PHP code changes were rolled back due to an error on line 142 of file wp-content/themes/XXXX/footer.php. Please fix and try saving again.
syntax error, unexpected '1' (T_LNUMBER)
Why is this happening when most forums i read say to that following code?
You are not escaping the quotes in the string and so the string itself ends just before the 1.
What your code is seeing
<?php echo do_shortcode("string"1"string"); ?>
To fix you can change it to single quotes.
<?php echo do_shortcode('[wpgmza id="1"]'); ?>
Here is more info on escaping strings https://www.php.net/manual/en/language.types.string.php
This question already has answers here:
PHP parse/syntax errors; and how to solve them
(20 answers)
Closed 6 years ago.
I'm quite new to PHP. I have created an array which I have included however when I need to echo a url which is in my settings array it just gives me the following error:
Parse error: syntax error, unexpected 'templateurl' (T_STRING) in C:\xampp\htdocs\index.php on line 15
Thanks for your help and time in advance.
Try this:
<?php include('hi.php'); echo $settings['templateurl'];?>
You need to include the file first and then you are able to retrieve the data from it.
This question already has answers here:
PHP parse/syntax errors; and how to solve them
(20 answers)
Closed 6 years ago.
I'm using this to determine if a variable is set. I am not a beginner and normally, this works (it's not complicated either)...
if(isset($ok)) {
[stuff happening]
}
This is the return:
Parse error: syntax error, unexpected '}' in firstlaunch.php on line 6
The thing is, that's that. My file is empty but for those few lines. I'm used to fixing those types of problems but I can't see why the error is coming since that's the only PHP on my page.
Ideas?
Thanks a lot!
++++++
Edit: the full script is:
<?php
$ok = isset($_GET['flag']);
if(isset($ok)) {
}
?>
Ok guys, thanks a lot for the HEX editor suggestion, it worked: I had this thing between my { }:
 
Wonder where that came from... But now my file executes!
Thanks!
This question already has answers here:
PHP parse/syntax errors; and how to solve them
(20 answers)
Closed 7 years ago.
Parse error: syntax error, unexpected '<' in N:\ftp\compc\ac12mm\Practical 3 Files\myContacts.php on line 102
Any Idea what would be wrong with this please?
Please help this is really fustrating me, Im not very good at php
You cannot include HTML Code directly in your PHP code.
To fix, you must use a command like echo, print(), or break from your PHP Code. This would require a PHP end block:
} else {
?>
<TD>
Or:
} else {
echo "<TD>";
See more: http://php.net/manual/en/tutorial.firstpage.php
This question already has answers here:
PHP parse/syntax errors; and how to solve them
(20 answers)
Closed 7 years ago.
MY code is quite simple.
<?php
echo "hello world";
?>
and i get this message
Parse error: syntax error, unexpected 'world' (T_STRING) in /usr/local/zend/apache2/htdocs/index2.php on line 2
I just copied the code from above on this page because it has the straight bar quotes instead of the curly quotes. I pasted this back into text editor... and wala! it work! thanks guys for the help!!! whoever said the idea about the quotes, i am one upping you or however this site works.