Javacript inside PHP

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
iknownothing
Forum Contributor
Posts: 337
Joined: Sun Dec 17, 2006 11:53 pm
Location: Sunshine Coast, Australia

Javacript inside PHP

Post by iknownothing »

Hey Guys,

I have the following line:

Code: Select all

$theurl = '?><script>window.location</script><?';
does anyone know how I can make this work. The reason why, is because the Javacript Get URL is the only one that shows Anchor tags, which I then need to convert into PHP to strip the string.


Thanks.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

php runs on the server. All output (echo, print, readfile ...) is sent to the client as repsonse to the request. The client parses the response and doesn't care if php did or didn't produce that data. The client might execute the javascript code in the response data.
Post Reply