buddylee17's code should work and is one way to do this ... but to answer your specific question -- no
PHP is a server-side language, which means it does all of its work on the server. Once the php page is loaded into the browser, there is nothing more that PHP can do. Your page is loaded in to the browser at this point, so PHP is out of the equation.
There are more sophisticated ways of doing this that do not open a static html page in a new window ... like what you see on this site when you mouse over one of the forum links in the forum index.
Buddylee17 - When I put the code above in my php code I got this:
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ',' or ';' in /data/13/1/150/135/1313461/user/1406792/htdocs/donate.php on line 133
I think this has html code and not php code and causes the error: Line 133 = <tr><td><p>3-digit Security Code:</p></td><td colspan=5 height=30><p><input type=text name=securitycode size=3 maxlength=3><a href="" onclick="window.open('help.html','', 'width=400, height=250, location=no, menubar=no, status=no,toolbar=no, scrollbars=no, resizable=no'); return false">(on back of card)</a></td></tr>
It sounds like if I have PHP window displayed I can not have a Pop-up window from the PHP code, does this sound right? Thx Rus
Buddylee17, the problem you are having is that you have not escaped the double-quotes of the html element.
It should look like this
$href = 'http://www.google.com'; print "<a href=\"$href\" target=\"blank\">(on back of card)</a>"; // or like this $href = 'http://www.google.com'; print '<a href="'.$href.'" target="blank">(on back of card)</a>'; // or like this $href = 'http://www.google.com'; print <<<ENDLINK <a href="$href" target="blank">(on back of card)</a> ENDLINK; // or like this print '<a href="http://www.google.com" target="blank">(on back of card)</a>';
// depending whether or not you need to include variable data inside the string
First, I would like to point out that html likes you to double-quote the values of attributes inside of element tags name="the_name" as in this example.
Second, I feel you are asking for trouble using a print "... some string .."; when the string is the size of an entire html page.
Instead use the heredoc format ...
... a string the size of a web page ...
Third, in the above code you do not include the <a href="http://www.google.com" target="blank">(on back of card)</a> we've been talking about, so I have no idea why that piece is not working.
Fourth, when placing example code on this site, please enclose it in the CODE tags provided, you can find this as the text formatting icon above this text entry field as a pound-sign (#). That will allow us to copy your code to our local computer much easier and have a look at it in an environment familiar to us.
So try fixing the print "... some string .."; statements in your code and see if this makes any difference.