Jump to content

php string with javascript popitup


jackdaniels187

Recommended Posts

Alright I am trying to deal with a small issue.

 

I need to have a javascript popup link echod by php.

 

This is the code I have now. I know it doesn't work. the quotes just aren't in the right place, can someone figure it out?

 

print '<a href="unit_note1.php?id='.$unitid." onClick=\"return popitup(\'unit_note1.php?id='.$unitid.'\')">Click here</a>'; 

 

here is a html instance of the similar code

 

<a href="unit_note1.php?id=<? print $unitid; ?>" onClick="return popitup('unit_note1.php?id=<? print $unitid; ?>')">Add note</a>

Link to comment
https://forums.phpfreaks.com/topic/192080-php-string-with-javascript-popitup/
Share on other sites

Just a question. Why are you bothering with pop-up code? How many browsers are set to block pop-ups, how many people welcome pop-ups like a long lost friend? If you really must pop something up to your visitors look at something easy to use. I would recommend ibox.

http://www.enthropia.com/labs/ibox/

 

 

HTH

Teamatomic

that ibox is cool, not needed for this situation and won't work. Must use popup.

 

I figured it out though. Thanks!

 

Here is the fixed version

<a href=\"unit_note1.php?id='.$unitid.' onClick="return popitup(\'unit_note1?qid='.$unitid.'\')">Click here</a>

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.