xjasonx Posted January 28, 2008 Share Posted January 28, 2008 echo 'window.open("nwindow.php?id=$id&title=$title","newwindow",config="height=500,width=400")'; When the new window opens, it just says "$title". I've been messing with the quotes forever and now I'm really sleepy. I'm sure this is an easy fix for someone. Quote Link to comment https://forums.phpfreaks.com/topic/88281-echo-php-vars-in-javascript-new-window-function/ Share on other sites More sharing options...
nethnet Posted January 28, 2008 Share Posted January 28, 2008 You cannot interpolate variables inside single quotes. Try something like this: echo "window.open(\"nwindow.php?id=$id&title=$title\",\"newwindow\",config=\"height=500,width=400\")"; Use double quotes when you contain variables inside an echo statement, or concatenate, or as I did above, escape other double quotes. Quote Link to comment https://forums.phpfreaks.com/topic/88281-echo-php-vars-in-javascript-new-window-function/#findComment-451737 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.