Jump to content

[SOLVED] Passing Image name and member ID to pupup window


TecTao

Recommended Posts

My problem is passing two variables a thumbnail image to a pupup window.  The thumbnail image is displayed from the image name stored in the DB identified by a member ID.  In the row or this member ID is a number of columns with image file names.

 

When you click on the thumbnail I can pass the member ID to use in the pupup query, but I can't seem to figure out how to pass the particular variable for the image name.

 

I'm using a java script to open a popup window displaying in image in a new window from a table of thumbnails.

 

The thumbnails and image are stored in a file on the server and called from a table in a DB with a member ID number and image file names.  The image names are in the DB in a row for a particular member.  In the Image table there are colums: m_id, img1, img2, img3.  member 2 has the same, member 3 has the same, and so on.

 

The page of thumbnails is called by a query where ID = $id, display image names from column img1, img2, img3

 

the java script code to open the pupup window is:

 

<a href="JavaScript:jsNewWindow('media/showimage.php?id=<? echo"$id"?>',500,500);">

<img src="http://www.worldboxingnetwork.com/query/media/<? echo $img_2 ?>?resize(200x300)" </a>

 

The popup window passes the the id.  I can't get the img file name to pass.  This is what i'm trying:

 

<input type="hidden" name="ud_id" value="<? echo "$id" ?>">

<? include($DOCUMENT_ROOT .'/include/db_connect.php') ?>

 

<?php

$result = mysql_query( "SELECT * FROM network_members_media WHERE i_Mid='$id' " )

or die("SELECT Error: ".mysql_error());

$num_rows = mysql_num_rows($result);

 

  while ($row = mysql_fetch_array($result))

  {

    extract($row);

 

?>

 

<img src="http://www.worldboxingnetwork.com/query/media/Variable Missing">

 

The blue Variable Missing"> is the variable I'm trying to pass when you click on the thumbnail.

Link to comment
Share on other sites

thanks for the ampersand, learned something new today, that's great.

 

about the $_GET haveing some difficulty makeing it work but used some other code the thumbnail code is:

 

<a href="JavaScript:jsNewWindow('media/showimage.php?id=<? echo"$i_Mid"?>&file=<? echo $img_2 ?>',500,500);">

<img src="media/<? echo"$i_Mid"?>/gick.php/<? echo $img_2 ?>?resize(200x200)" border="0"></a>

 

 

the popup page is:

 

<input type="hidden" name="ud_id" value="<? echo "$id" ?>">

<input type="hidden" name="ud_file" value="<? echo "$file" ?>">

 

 

I tried

 

$id = $_GET[id];

$file = $_GET[file];

 

but it didn't work.

 

thanks fot the help, it really paid off.

Link to comment
Share on other sites

OK, I'm confused. I see parameters being passed with a URL and then I see parameters that are submitted by a form. That's two different things that use differently-named variables.  If you're doing something with the form, then what you retrieve must be the same named variables as declared in the form.  And if the form method is GET, retrieve from the $_GET array, otherwise retrieve from the $_POST array.

Link to comment
Share on other sites

<input type="hidden" name="ud_id" value="<? echo "$id" ?>">
<input type="hidden" name="ud_file" value="<? echo "$file" ?>">

//is retrieved by 
$id = $_GET['ud_id'];
$id = $_GET['ud_file'];

 

The get data corresponds to the input name.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.