hi guys...i have this prooblem which i like to acho a window pop up...but i cannot do so...the link does not seem to work and i cannot find any error in it.

I wonder if anyone can find any error here:

$ancpopup = "<div id=\"anctrigger\"><a href=\"#\" onclick=\"window.open(\'m_ancpopup.php?page=\'$eid\',\'ancpopup\',\'width=670px,height=470px,left=0px,top=100px,screenX=0,screenY=100\')\">Accident &amp; Conviction EXIST!</a></div>";

            echo $ancpopup;

Thanks in advance.

6 Years
Discussion Span
Last Post by veedeoo


    $ancpopup = "<div id=\"anctrigger\"><a href=\"#\" onclick=\"window.open('m_ancpopup.php?page=".$eid."','ancpopup','width=670px,height=470px,left=0px,top=100px,screenX=0,screenY=100')\">Accident &amp; Conviction EXIST!</a></div>";
echo $ancpopup;

Don't forget to define your $eid, and then your mysql query.. You don't have to escape single quote if you use double quotes to define your echo. The same is true if single quote is used.. e.g. echo ""; and echo''. However, the echo " $someVariable"; the $someVariable is evaluated by the php parser, but not in sigle quote as in echo '$someVariable'; this will give you $someVariable printed out on the screen.. Alternatively, you can echo $someVariable; without the need of double quote if there is no other text string, html tags, javascript need to be printed or evaluated.

Single quote sample...

$someName = "myName";

echo 'My Name is '.$someName.'<br/>';

This above $someName will get evaluated.., but this one will not

echo 'My Name is $someName <br/>';

Edited by veedeoo: more info added


If 'something' echos to screen from the code,
and the popup does not popup, are you running, popup blockers.
99% of your potential users are also running some popup blocker, just by default browser install,
show/hide layers containing the information that m_ancpopup.php would display, in the current page may be better, than trying to defeat everyone's security settings
something like

<?php if(mysql_num_rows($result)<>0){
echo "<div id=\"anctrigger\" name=\"anctrigger\"><a href=\"#anctrigger\" onclick=\"document.getelementbyid(\'showme\').display.block);\">Accident &amp; Conviction EXIST!</a></div>
<div id=\'showme\' style=\'display:none;width:670px;height:470px;left:0;top:100px;\'>";

//output of m_ancpopup.php?page=$eid perhaps as include(m_ancpopup.php)

echo "<a href=\"#\" onclick=\"document.getelementbyid(\'showme\').display.none);\"> Close! </a></div>";
} ?>

the alteration in the href and name in anctrigger element should prevent the browser jumping to the top of the page, by keeping focus to the named element onclick href='#' defaults to the top of the age

lousy code, not certain its correct, idea without completion, its not my projuect, just trying to help

Edited by almostbob


You're welcome. Just make sure to mark this as solved.... good thing it all worked out for you..

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.