/    Sign up×
Community /Pin to ProfileBookmark

help with sorting out quotes in expression

This works:

[code=html]<a href=”#” onclick=”window.open(‘supporters_list.php’,’_blank’,’height=400, left=100, location=no, menubar=no, resizable=no, scrollbars=yes, status=no, titlebar=no, toolbar=no, top=150, width=850′)” alt=”link to Supporters list”>review Supporters list</a><br><br>
[/code]

This doesn’t work:

[code=php]<?php
print ‘<td>’.$row[4].'</td><td>’.$row[5].'</td><td>’.$row[6].'</td><td><a href=”#” onclick=”window.open(“supporter_interests.php?supporter=’.$row[0].'”,”_blank”,”height=250, left=100, location=no, menubar=no, resizable=no, scrollbars=yes, status=no, titlebar=no, toolbar=no, top=150, width=450″)”>Interests</a></td></tr>’;
?>[/code]

The trouble comes, of course, with needing concatenate a variable into the javascript argument string. I’m sure there has to be a way to do it, but nothing I’ve tried works. Any help will be greatly appreciated.

to post a comment
PHP

4 Comments(s)

Copy linkTweet thisAlerts:
@chickenlandJan 10.2006 — [CODE]
<?php
print '<td>'.$row[4].'</td><td>'.$row[5].'</td><td>'.$row[6].'</td>';
?>
<td><a href="#" onclick='window.open("supporter_interests.php?supporter=<?php echo $row[0]; ?>","_blank","height=250, left=100, location=no, menubar=no, resizable=no, scrollbars=yes, status=no, titlebar=no, toolbar=no, top=150, width=450")'>Interests</a></td></tr>';
<?php
?>
[/CODE]
Copy linkTweet thisAlerts:
@strBeanauthorJan 10.2006 — Gee, that looked promising.

I'm getting this error:

Parse error: parse error, unexpected '"' in /usr/www/users/washing3/private/supporters_list.php on line 48

Line 48 is the line you tweaked for me. There's no backslash anywhere in the line, nor in the value of the variable. There's nothing missing on the previous line, either.

Hmmm.
Copy linkTweet thisAlerts:
@NogDogJan 10.2006 — [code=php]
<?php
print <<<EOD
<td>{$row[4]}</td><td>{$row[5]}</td><td>{$row[6]}</td><td>
<a href="#" onclick="window.open('supporter_interests.php?supporter={$row[0]}','_blank','height=250, left=100, location=no, menubar=no, resizable=no, scrollbars=yes, status=no, titlebar=no, toolbar=no, top=150, width=450')">Interests</a></td></tr>
EOD;

?>
[/code]
Copy linkTweet thisAlerts:
@strBeanauthorJan 11.2006 — Thanks, NogDog. I didn't get an email this time, so I didn't know you'd posted. In the meantime, I replaced the javascript inside that print stmt and put it in a js function, which solved my quotes mixup for me.

When I saw your code, I decided to try it. I still got an error that I didn't understand, like I'd forgotten a closing brace somewhere, but I sure couldn't find it.

Thanks again.
×

Success!

Help @strBean 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.27,
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,
)...