Parse error: parse error, unexpected T_STRING, expecting

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
cyberpro
Forum Newbie
Posts: 2
Joined: Wed Oct 15, 2003 12:35 am

Parse error: parse error, unexpected T_STRING, expecting

Post by cyberpro »

I have this error message:

Parse error: parse error, unexpected T_STRING, expecting ',' or ';' in /home/php/nuevapostal.php on line 105

This is the line 105:

What's the problem?

Code: Select all

Echo "<p align='justify'><b><font face="Verdanas" size='3'>Send<br></font></b><font face="Verdanas" size='2'>Thaks for using this service<p align=center><b><a href='index.php'>Volver</a></font></p>";
Admin Edit: PHP tags added for clarity

Thanks!
jollyjumper
Forum Contributor
Posts: 107
Joined: Sat Jan 25, 2003 11:03 am

Post by jollyjumper »

Hi Cyberpro, the problem lies in the font face="Verdanas", you should use single quotes around there because you used double quotes to start the echo. You could also use \" to allow double quotes.

use this:

Code: Select all

<font face='Verdanas' size='3'>
or this:

Code: Select all

<font face="Verdanas" size='3'>
Admin Edit: CODE tags added for clarity

Greetz Jolly.
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

You can also do:

Code: Select all

echo '<p align="justify"><b><font face="Verdana" size="3">Send<br></font></b><font face="Verdanas" size="2">Thaks for using this service<p align="center"><b><a href="index.php">Volver</a></font></p>';
Try and be consistent with how you use quotes in HTML and it will all become a lot easier.

Mac
Nay
Forum Regular
Posts: 951
Joined: Fri Jun 20, 2003 11:03 am
Location: Brisbane, Australia

Post by Nay »

One more way, (yeah, guys, I always have to mention it, don't I? :D) is the heredoc style.

Code: Select all

echo <<< END
<p align="justify">
<font face="verdana" size="3">
<strong>Send</strong>
</font>
</p>

<br />

<font face="verdana" size="2">
Thanks for using this service
<p align="center">
<strong>
<a href="index.php">Volver</a>
</strong>
</p>
</font>
END;
It's something like echo "until" END;. So it'll output everything it sees until END. Neat, eih?

and hehe yeah, I just couldn't stand it and made your code XHTML complaint too :D. Well, not fully complaint but will do.

-Nay

ps: At the end of the day, it's all about preference. You don't really have to "do it properly" in PHP since there are tons of ways to do a thing.
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

Nay wrote:I just couldn't stand it and made your code XHTML complaint too :D.
:lol: but you didn't replace the font tags or the align attributes...

Mac
Nay
Forum Regular
Posts: 951
Joined: Fri Jun 20, 2003 11:03 am
Location: Brisbane, Australia

Post by Nay »

I know :lol:. If I did I would have to be writing a style sheet for him too! Since then I'd be using style="", but I never use style="". I seem to be alergic to it!!

woah, so yea, I use classes and id for all my div and other styles. What a pain, but yeah, it's me :D.

And also, I like to <link rel="stylesheet" href="styles.css" /> rather than make an internal stylesheet. *sighs*

-Nay
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

link rel= ? tztztz, is it xml or is it not? ;-)
<?xml-stylesheet href="http://www.w3.org/StyleSheets/TR/W3C-REC.css" type="text/css"?>
<?xml-stylesheet href="#internalStyle" type="text/css"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
[...]
cyberpro
Forum Newbie
Posts: 2
Joined: Wed Oct 15, 2003 12:35 am

Thanks

Post by cyberpro »

Thanks!

--------------------------------------------------------------------------------------------------
jollyjumper wrote:Hi Cyberpro, the problem lies in the font face="Verdanas", you should use single quotes around there because you used double quotes to start the echo. You could also use " to allow double quotes.

use this:

Code: Select all

<font face='Verdanas' size='3'>
or this:

Code: Select all

<font face="Verdanas" size='3'>
Admin Edit: CODE tags added for clarity

Greetz Jolly.
Post Reply