/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] PHP & JavaScript Help

Hi,

I am creating a website for my friends music company. What I’ve done so far is made a PHP script that gets the url of the song name from the MySQL database and then puts it into a PHP variable. What I’m needing help on is embedding PHP into JavaScript. I am new to JS so bare with me. I will use a basic PHP variable for the example below. Thanks in advance:

[CODE]
<?php
$songname = “1.mp3″;
?>

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

<script type=”text/javascript”>
var so = new SWFObject(“playerSingle.swf”, “mymovie”, “192”, “67”, “7”, “#FFFFFF”);
so.addVariable(“autoPlay”, “yes”);
so.addVariable(“soundPath”, “<?php $songname ?>”); [B]#1[/B]
so.write(“flashPlayer”);
</script> [/CODE]

#1 is what I need help on.

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@FangDec 15.2009 — so.addVariable("soundPath", "&lt;?php echo $songname ?&gt;");
Copy linkTweet thisAlerts:
@inulledauthorDec 15.2009 — Thanks, I forgot the echo. Even though I'm an expert in PHP. LOL.....
×

Success!

Help @inulled 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.28,
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,
)...