Jump to content

Recommended Posts

Hi this is probably a easy question but i have been rattling my mind to it for about half an hour now .  Im using an onclick event of a button to open a new webpage passing a PHP variable through the url

 

at the moment im trying to use the following code.

 

onclick="window.open('otherwebpage.php?itemtopassinurl=<? echo "$title[$i]"; ?>','popuppage','width=300,toolbar=1,resizable=0,scrollbars=yes,height=700,top=100,left=100')" ?>'

 

I know i cant use the " " in the php bit of the code but i dont know what to use instead .  I assume i cant use the ' character either???

 

How can i do this?

 

Cheers

Link to comment
https://forums.phpfreaks.com/topic/241083-passing-php-variable-through-url/
Share on other sites

Original:

onclick="window.open('otherwebpage.php?itemtopassinurl=<? echo "$title[$i]"; ?>','popuppage','width=300,toolbar=1,resizable=0,scrollbars=yes,height=700,top=100,left=100')" ?>'

 

Revised:

onclick="window.open('otherwebpage.php?itemtopassinurl=<?php echo $title[$i]; ?>','popuppage','width=300,toolbar=1,resizable=0,scrollbars=yes,height=700,top=100,left=100')"

 

 

its worth noting that use of <? the shortcode version shouldn't be used in general as its a depreciated method that I believe come PHP v6 will be removed all together.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.