/    Sign up×
Community /Pin to ProfileBookmark

I received this wierd message:

Parse error: parse error, expecting `‘,” or `‘;” in /home/iwdtests/public_html/PHPAdvanced/Registration/register.php on line 176

I understand what parse error means, and was doing well finding my mistakes. However, on line 176, this is the code:

[code=php]<tr>
<td align=”right”>Email Address:</td>
<td align=”left”><input name=”email” type=”text” size=”25″ maxlength=”60″ value=”<?=HTTP_POST_VARS[email]?>”></td>
<td align=”left”><small>Use whichever email address you want to receive notices, etc.</small></td>
</tr>[/code]

Since value=”<?=HTTP_POST_VARS[email]?>”> is the only php on that line, I don’t understand where the “,” should be placed.

I do know that I am subject to finding more small errors, but this one has me stumped.

Thanks in advanced.

BTW, I’m working from PHP Advanced, by Larry Ullman, page 135.

Peggy

to post a comment
PHP

6 Comments(s)

Copy linkTweet thisAlerts:
@MstrBobJun 30.2004 — [code=php]
<input name="email" type="text" size="25" maxlength="60" value="<?PHP echo($_POST['email']);?>"></td>
<td align="left">
[/code]


That should work. You need to echo the value, and should use $_POST[] instead, I don't trust superglobals.
Copy linkTweet thisAlerts:
@ShrineDesignsJun 30.2004 — MstrBob, <?=$var?> and <?php echo $var; ?> will output the same results, the first method is shorthand, however, it will only work if [i]short_open_tag[/i] is enabled
Copy linkTweet thisAlerts:
@MstrBobJun 30.2004 — Really? That doesn't work for me. I shall have to look that up in my .ini file...

Anywho, the issue were your missing single quotes in $HTTP_POST_VARS[].
Copy linkTweet thisAlerts:
@shimonJun 30.2004 — Magic - ignore 'em all ? the issue is that you missed the $ sign off of $HTTP_POST_VARS

Bob - $HTTP_POST_VARS is not a superglobal, whereas $_POST actually is. Check it out: http://www.php.net/manual/en/reserved.variables.php

$_POST: This is a 'superglobal', or automatic global, variable. This simply means that it is available in all scopes throughout a script. You don't need to do a global $_POST; to access it within functions or methods, as you do with $HTTP_POST_VARS.[/quote]
Copy linkTweet thisAlerts:
@MstrBobJul 01.2004 — Argh, I'm so confused now x.x
Copy linkTweet thisAlerts:
@shimonJul 01.2004 — bonkers isn't it? I had always thought the two were identical - just with one being shorthand for the other. We live and learn eh? ?
×

Success!

Help @Magikey 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.5,
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: @Yussuf4331,
tipped: article
amount: 1000 SATS,

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

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...