/    Sign up×
Community /Pin to ProfileBookmark

Small syntax error

Hi all,

Just wondering if anybody can spot the syntax error with the below.

[CODE]
‘<button type=”button” onclick=”window.location=’bookview.php?id=’. $row[‘bookingref’].’&hn’. $row[‘hotelname’].””>Book Now</button>’
[/CODE]

It works fine when I just append one row to the URL like this

[CODE]
‘<button type=”button” onclick=”window.location=’results.php?id=’. $row[‘proposalid’] . ””>Book Now</button>’
[/CODE]

The button only stops workin when I append the second ‘hotelname’ row.

Think its just a syntax error but I cant manage to spot it.

Any suggestions would be much appreaciated

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@TeufelSep 16.2009 — Is it a PHP Syntax Error or a Javascript Syntax error?

Also, you forgot the = after &hn
Copy linkTweet thisAlerts:
@andre4s_ySep 17.2009 — Yes, suggestion :

why don't you use form, if you have code readable difficulity?
[code=php]
<form action="bookview.php" method="get">
<?php

echo '<input type="hidden" name="id" value="'.$row['bookingref'].'" />';
echo '<input type="hidden" name="hn" value="'.$row['hotelname'].'" />';

?>
<input type="submit" value="Book Now" />
</form>
[/code]

In this case : readable = more bytes sent to user. ? tradeoff..
Copy linkTweet thisAlerts:
@scragarSep 17.2009 — Yes, suggestion :

why don't you use form, if you have code readable difficulity?
[code=php]
<form action="bookview.php" method="get">
<?php

echo '<input type="hidden" name="id" value="'.$row['bookingref'].'" />';
echo '<input type="hidden" name="hn" value="'.$row['hotelname'].'" />';

?>
<input type="submit" value="Book Now" />
</form>
[/code]

In this case : readable = more bytes sent to user. ? tradeoff..[/QUOTE]


And you don't demand javascript be enabled for basic functionality, double tradeoff and well worth it.
×

Success!

Help @debuitls 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 6.16,
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: @nearjob,
tipped: article
amount: 1000 SATS,

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

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