...

View Full Version : Selection Box Popup Window



geekgirl101
03-02-2007, 12:47 PM
My apologies for posting this as a reply to but I cannot find the "New Post" button on the forum itself.

I'm needing help in creating a selection box that on submission opens a popup that gets image thumbnails matching the selection, then on selecting one of the thumbnails updates or reloads the previous window with information that matches that thumbnail. Can this be done? I so far have the selection box opening the popup with the thumbnails, but I don't know how to make the thumbnails update the previous window.

SSJ
03-02-2007, 01:10 PM
post your code

sir pannels
03-02-2007, 05:34 PM
there is no code yet, he was just asking if it could be done :)

geekgirl101
03-02-2007, 06:55 PM
<form name="skinsearch" action="skinsearch.php" method="post" target="myWindow">
<span class="head3">Search by Skin</span><br />
<hr />
Family
<SELECT name="skinsearch">
<OPTION SELECTED value="<?php echo $skinsearch;?>"><?php echo $skinsearch;?></OPTION>
<OPTION value="Bird">Bird</OPTION>
<OPTION value="Cat">Cat</OPTION>
<OPTION value="Dog">Dog</OPTION>
</SELECT>
<hr />
<input type="submit" value="Search" onclick="doSubmit()" />
</form>




<html>
<head>
<title>Search by Skin</title>
<link rel="stylesheet" href="style.css" type="text/css" />
</head>
<body>

<?php
include 'config.php';
include 'opendb.php';

if(isset($_POST['skinsearch']))
{
$skinselect = "SELECT DISTINCT Family, Skin from petlist WHERE Family = '". $_POST['skinsearch'] ."'";
$showgif = mysql_query($skinselect) or die(mysql_error());

echo "<table border='0' width='380'>\n";
echo "<tr>\n";
echo "<td class='blue1' valign='top'>\n";

while($row = mysql_fetch_array($showgif, MYSQL_ASSOC))
{
echo "<img src='images/db/skinthumb/{$row['Skin']}'/>";
}

echo "</td>\n";
echo "</tr>\n";
echo "</table>";
}
?>
</body>
</html>


This is all I have to open the selected option into a popup (skinsearch.php) I'm wanting it to be possible to make it that the user can then click on an image in skinsearch.php and it will reload or replace results.php in the main browser window where it will then select from the database that matches that image and display it.

Inigoesdr
03-02-2007, 07:22 PM
My apologies for posting this as a reply to but I cannot find the "New Post" button on the forum itself.

I'm needing help in creating a selection box that on submission opens a popup that gets image thumbnails matching the selection, then on selecting one of the thumbnails updates or reloads the previous window with information that matches that thumbnail. Can this be done? I so far have the selection box opening the popup with the thumbnails, but I don't know how to make the thumbnails update the previous window.
To open the popup you would do something like this:
http://www.webmasterworld.com/javascript/3263568.htm
Or just search for "onchange popup" or "onselect popup" or something similar.

And to change the parent window's location check out:
http://www.google.com/search?q=javascript+parent+window+location

geekgirl101
03-03-2007, 06:13 PM
Thank you, but how do I change it that by clicking on one of the many thumbnails in the popup that it displays everything related about that particular image using select from database in the parent window?

Inigoesdr
03-03-2007, 07:22 PM
Thank you, but how do I change it that by clicking on one of the many thumbnails in the popup that it displays everything related about that particular image using select from database in the parent window?
When you list the thumbnails in the popup window you would link them using something like this:


while($row = mysql_fetch_assoc($showgif))
{
?><a href="#" onclick="javascript: parent.location.href='thumbinfo.html';"><img src="images/db/skinthumb/"<?=$row['Skin'];?>" /></a><?
}

That's just an example, read up on it and format it to fit your site.

Also, you should ALWAYS sanitize any input from users. At least mysql_real_escape_string():


if(isset($_POST['skinsearch']))
{
$_POST['skinsearch'] = mysql_real_escape_string($_POST['skinsearch']);

geekgirl101
03-04-2007, 12:49 PM
When you list the thumbnails in the popup window you would link them using something like this:


while($row = mysql_fetch_assoc($showgif))
{
?><a href="#" onclick="javascript: parent.location.href='thumbinfo.html';"><img src="images/db/skinthumb/<?=$row['Skin'];?>" /></a><?
}

That's just an example, read up on it and format it to fit your site.

I tried this and the result was that on clicking the images in the thumbnail it displayed the result.php in the popup instead of the parent and still didn't display any information regarding the thumbnail.

Inigoesdr
03-04-2007, 04:59 PM
I tried this and the result was that on clicking the images in the thumbnail it displayed the result.php in the popup instead of the parent and still didn't display any information regarding the thumbnail.

You have to reference the thumbnail ID or however you are storing the information about it and use the page opened in the parent window to retrieve and show it:

<a href="#" onclick="javascript: opener.location.href = 'thumbinfo.php?id=1'; return false;">Click to change parent</a>

geekgirl101
03-05-2007, 12:20 PM
You have to reference the thumbnail ID or however you are storing the information about it and use the page opened in the parent window to retrieve and show it:

<a href="#" onclick="javascript: opener.location.href = 'thumbinfo.php?id=1'; return false;">Click to change parent</a>

This would only assume that I'm using a static link and that the database only has unique thumbnails to each entry. I'll give a little example of what I currently have:



+--------+----------+----+----+------------------+
|Name |Family |Age |Sex |Skin |
|--------|----------|----|----|------------------|
|Anne |Bird | 2 | F |birdskincanred |
|Ben |Bird | 2 | M |birdskincanyellow |
|Tabby |Cat | 4 | F |catskintabby |
|Fifi |Cat | 3 | F |catskintabby |
|Fido |Dog | 4 | M |dogskindalmation |
|Jenn |Dog | 3 | F |dogskindalmation |
|Buster |Dog | 2 | M |dogskinlabrador |
+--------+----------+----+----+------------------+


The idea here is that the user gets to select what Family they want in the main window from a dropdown menu which is in search.php(this is included in index.php along with results.php which shows a default welcome message), this opens a popup showing the skins available in image form, the user then clicks on an image and this updates results.php in the main window with a table showing pet details for pets that have that image.

Inigoesdr
03-05-2007, 01:15 PM
Use results.php?family=dog or whatever then.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum