# Can you write javascript inside php?

**URL:** <https://forum.kirupa.com/t/can-you-write-javascript-inside-php/231346>\
**Category:** Uncategorized\
**Created:** [July 3, 2007, 11:23pm UTC](https://forum.kirupa.com/t/can-you-write-javascript-inside-php/231346 "2007-07-03T23:23:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![acc](https://avatars.discourse-cdn.com/v4/letter/a/b38774/32.png) [@acc](https://forum.kirupa.com/u/acc)\
**Post date:** [July 3, 2007, 11:23pm UTC](https://forum.kirupa.com/t/can-you-write-javascript-inside-php/231346/1 "2007-07-03T23:23:00Z")

</div>

I’m just starting to learn php, but familiar with asp.

I need to write this script to embed a flash file

```auto

<script type="text/javascript">

        var fo = new SWFObject("viewer.swf", "viewer", "100%", "100%", "7", "#181818");    

        fo.addVariable("preloaderColor", "0xffffff");

        fo.addVariable("xmlDataPath", "gallery.xml");    

        fo.write("flashcontent");    

    </script>    

```

The reason I wish to write this in PHP is that I want the

```auto

"gallery.xml"

```

to be a number that will keep changing depending on what link is selected based on a query from the link

if name.php?id=138 is selected, then the xml file to be used is 138.xml

Is this possible?
