/    Sign up×
Community /Pin to ProfileBookmark

Passing Values

I guess this could be a PHP problem or a Javascript problem, depending on what I’m doing wrong but here it goes:

<script language=”javascript” type=”text/javascript”>

window.top.window.stopUpload(<?php echo $errors;?>, <?php echo $newname;?>);

</script>

For some reason I can’t pass the newname. Passing $errors (which is an integer) works fine. But passing $newname (which is a string) does not.

I even tried hard-coding it to:

[code=php]
window.top.window.stopUpload(<?php echo $errors;?>, <?php echo ‘123456.jpg’;?>);
[/code]

with no results. However,

[code=php]
window.top.window.stopUpload(<?php echo $errors;?>, ‘123456.jpg’>);
[/code]

does work. Which is nice, but I need to use php because it’s a variable, not a hard-coded image every time. And by the others not working, I mean literally the value doesn’t get passed.

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@DerokorianMay 17.2011 — [code=php]
window.top.window.stopUpload(<?php echo $errors;?>, '<?php echo $newname;?>');
[/code]


Notice the quotes around the php echo $newname, which will put the echo in quotes in the finished product. As it stands now it is not in quotes, probably the problem.
Copy linkTweet thisAlerts:
@GalwayauthorMay 17.2011 — [code=php]
window.top.window.stopUpload(<?php echo $errors;?>, '<?php echo $newname;?>');
[/code]


Notice the quotes around the php echo $newname, which will put the echo in quotes in the finished product. As it stands now it is not in quotes, probably the problem.[/QUOTE]


Those were unfortunately just a typo in my question.

EDIT: Oooooh. I seeee. Thanks I'll give that a try.
×

Success!

Help @Galway 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.1,
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,
)...