TecTao Posted March 12, 2007 Share Posted March 12, 2007 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. Quote Link to comment Share on other sites More sharing options...
AndyB Posted March 12, 2007 Share Posted March 12, 2007 Use ampersands to pass additional values with the filename, i.e. a href="filename.php?var1=x&var2=y&var3=z ........" Retrieve the passed values from the $_GET array in filename.php Quote Link to comment Share on other sites More sharing options...
TecTao Posted March 12, 2007 Author Share Posted March 12, 2007 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. Quote Link to comment Share on other sites More sharing options...
AndyB Posted March 14, 2007 Share Posted March 14, 2007 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. Quote Link to comment Share on other sites More sharing options...
per1os Posted March 14, 2007 Share Posted March 14, 2007 <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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.