graham23s Posted August 11, 2009 Share Posted August 11, 2009 Hi Guys, I'm not sure if this is more PHP or a javascript problem (both really) i'm trying to pass a url to a javascript function using php. code: <a href="#" onclick="payScreenPopup(<?php print 1; ?>);"><img src="img/img-button.gif" border="0"></a> function payScreenPopup(affURL) { alert(affURL); var l = screen.availWidth / 2 - 450; var t = screen.availHeight / 2 - 320; var win = window.open(affURL, 'papPopupMain', 'width=900,height=650,left='+l+',top='+t+',scrollbars=1'); } The problem is numbers get through and are alerted fine, but when i try any kind of text it doesn't seem to get through and popup, i'm not sure if it's something i need to do on the php side of things or javascript. any help would be appreciated thank guys Graham Link to comment https://forums.phpfreaks.com/topic/169748-passing-through-php-code/ Share on other sites More sharing options...
Mark Baker Posted August 11, 2009 Share Posted August 11, 2009 Even in javascript, string values need to be quoted <a href="#" onclick="payScreenPopup('<?php print 1; ?>');"><img src="img/img-button.gif" border="0"></a> Link to comment https://forums.phpfreaks.com/topic/169748-passing-through-php-code/#findComment-895508 Share on other sites More sharing options...
Mark Baker Posted August 11, 2009 Share Posted August 11, 2009 Even in javascript, string values need to be quoted <a href="#" onclick="payScreenPopup('<?php print 'abc'; ?>');"><img src="img/img-button.gif" border="0"></a> Link to comment https://forums.phpfreaks.com/topic/169748-passing-through-php-code/#findComment-895511 Share on other sites More sharing options...
graham23s Posted August 11, 2009 Author Share Posted August 11, 2009 ah thanks mark works perfect Graham Link to comment https://forums.phpfreaks.com/topic/169748-passing-through-php-code/#findComment-895512 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.