tomhilton
11-12-2003, 07:30 AM
Hi, I have a page that loads a small popup with images when you click on a link. I am using PHP/MySQL to pull info from a database, and javascript to pass an image variable to a popup page. In the header the following function is defined:
function meatloaf(page){
var openup
openup=window.open(page,'photopage','width=480,height=360,directories=yes,location=yes,menubar=yes,s crollbars=yes,status=yes,toolbar=yes,resizable=yes,screenX=25,screenY=100,top=25,left=100')
}
in the body I have a PHP loop that fetches a mysql array. within the loop is the following script:
<script language="Javascript">
<!-- Hide script from old browers
upload_id = <?php echo "$id" ?>;
destination = "single_photo.php?info="+upload_id;
// End hiding
</script>
<a href='#' onclick="meatloaf(destination)">
In this case, the loop scrolls through about 8 or so items, My problem is that no matter which anchor tag i click on, the last definition of "destination" is the one that pops up. Is there a better way to pass php variables into javascript so that each anchor tag will contain the correct javascript link?
function meatloaf(page){
var openup
openup=window.open(page,'photopage','width=480,height=360,directories=yes,location=yes,menubar=yes,s crollbars=yes,status=yes,toolbar=yes,resizable=yes,screenX=25,screenY=100,top=25,left=100')
}
in the body I have a PHP loop that fetches a mysql array. within the loop is the following script:
<script language="Javascript">
<!-- Hide script from old browers
upload_id = <?php echo "$id" ?>;
destination = "single_photo.php?info="+upload_id;
// End hiding
</script>
<a href='#' onclick="meatloaf(destination)">
In this case, the loop scrolls through about 8 or so items, My problem is that no matter which anchor tag i click on, the last definition of "destination" is the one that pops up. Is there a better way to pass php variables into javascript so that each anchor tag will contain the correct javascript link?