Hello i am trying to create a script that will allow for the user to click a link and pop up page opens up with the content from the same page
e.g

<?php
$option = $_GET['option'];
?>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function topWindow(){
popup = window.open("page1.php?option=<?php echo $option; ?>","scrollbars=no");
}
// End -->
</SCRIPT>

<?php
// list
echo "<a href=$PHP_SELF?option=1 onclick=\"topWindow()\">Link 1 </a>";
echo "<a href=$PHP_SELF?option=2 onclick=\"topWindow()\">Link 2 </a>";
echo "<a href=$PHP_SELF?option=3 onclick=\"topWindow()\">Link 3 </a>";

if ($option == 1)
{
 // show this data in pop up
}
if ($option == 2)
{
 // show this data in pop up
}
?>

So what?

commented: fair comment +8

So what?

Thanks for the help !!!

Member Avatar for diafol

You didn't say what the problem was, if there is a problem. Smants is right, I'd have said the same thing. Either that or I've got the wrong end of the stick. Are you proposing this as a tutorial / code snippet?

@smants - felt I had to redress the balance of the rep. when it happens to me, I just swell the old ignore list by a unit. :)

as i have said im trying to create a script that will allow for the user to click a link and pop up page opens up with the content from the same page...

i have put the code on that i have written but its not working? thts why i posted it

Member Avatar for diafol

> as i have said im trying to create a script that will allow for the user to click a link and pop up page opens up with the content from the same page...

i have put the code on that i have written but its not working? thts why i posted it

You didn't say it wasn't working nor did you state which bit wasn't working.

Well, your code is mangled in many ways:

No html structure.
$_GET should be conditional - error if no option in querystring and js will fail
script tag should have type attribute instead of language
should quote urls in a tags
end handlers with a ';'
it's $_SERVER

Once you sort that lot out, post it again and state clearly what's not working. No point getting shirty with somebody that may have helped you if you outlined the nature of the problem.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.