plastik77 Posted January 29, 2008 Share Posted January 29, 2008 Apologies in advance for this one but i'm afraid i don't know to solve it! I'm just trying to echo the following html line in my php: The working html is: <select name = "drop_option" onchange="window.open(this.options[this.selectedIndex].value,'_top')"> but when i need to do this within php i can't get it right as the '_top' parameter neither works with or without quotes... the faulty php: echo "<select name = 'drop_sub_option' onchange='window.open(this.options[this.selectedIndex].value,_top)'>"; how do i ensure '_top' has the correct syntax within the php statement? Quote Link to comment https://forums.phpfreaks.com/topic/88429-simple-problem-trying-to-echo-html-with-single-and-double-quotes/ Share on other sites More sharing options...
PHP Monkeh Posted January 29, 2008 Share Posted January 29, 2008 Just escape the quotes: <select name = \"drop_option\" onchange=\"window.open(this.options[this.selectedIndex].value,'_top')\"> Then you can use the single quotes for your onchange Quote Link to comment https://forums.phpfreaks.com/topic/88429-simple-problem-trying-to-echo-html-with-single-and-double-quotes/#findComment-452593 Share on other sites More sharing options...
revraz Posted January 29, 2008 Share Posted January 29, 2008 Odd, there isn't anything wrong with your first string. Quote Link to comment https://forums.phpfreaks.com/topic/88429-simple-problem-trying-to-echo-html-with-single-and-double-quotes/#findComment-452601 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.