Maryam Butt Maryam Butt - 3 months ago 9
PHP Question

how to open a new file in php by clicking on some image click

I want to open a new window on image click. My code is:

<img src="images/input.jpg" width="100" style="border-radius:20px;
cursor:pointer;" onclick="javascript:window.open(<?php echo"<a
href='data.php?id=$date&id1=$d'></a>"?>,'','width=870,height=620');">


But it's not working;
id
and
id1
are not passed on to the next page to be opened.

How can I fix this?

Answer

you need to use the direct url for window.open statement

<img src="images/input.jpg" width="100" style="border-radius:20px; cursor:pointer;"onclick="javascript:window.open(<?php echo"'data.php?id=$date&id1=$d'"?>,'','width=870,height=620');">