/    Sign up×
Community /Pin to ProfileBookmark

echo problem in PHP

Well I have a Form and when Invalid data is put into a specific form, the word “Error” appears in that text field within the form. I am REALLY noob to this, but the error seems a bit weird.

[code=php]
<td width=”79%” class=”style2″><input name=”FirstName” type=”text” id=”FirstName” value=”<?php
if($_SESSION[“errorfn”]==1)
{
echo “<class=”error”>Error”;
}
else
{
echo $_SESSION[“fname”];
}

?>” “size=”49″ maxlength=”25”></td>
[/code]

Thats what I have. Now this is the error.

Parse error: parse error, expecting `‘,” or `‘;” in c:inetpubwwwrootInvalidData.php on line 122

The echo “<class=”error”>Error”; line is line 122.

I don’t see it. Where do I need one of those characters?

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@jebster1caNov 14.2004 — You have to escape the quotes in side a string:
[code=php]
<td width="79%" class="style2"><input name="FirstName" type="text" id="FirstName" value="<?php
if($_SESSION["errorfn"]==1)
{
echo "<class="error">Error";
}
else
{
echo $_SESSION["fname"];
}

?>" "size="49" maxlength="25"></td>
[/code]


?
Copy linkTweet thisAlerts:
@ForeverIriseauthorNov 14.2004 — You live, you learn.
×

Success!

Help @ForeverIrise spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...