Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 11 of 11
  1. #1
    New to the CF scene
    Join Date
    Mar 2007
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #2
    SSJ
    SSJ is offline
    Regular Coder
    Join Date
    Mar 2007
    Posts
    230
    Thanks
    0
    Thanked 4 Times in 4 Posts
    post your code

  • #3
    Regular Coder
    Join Date
    Jun 2002
    Posts
    905
    Thanks
    23
    Thanked 5 Times in 5 Posts
    there is no code yet, he was just asking if it could be done

  • #4
    New to the CF scene
    Join Date
    Mar 2007
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by search.php
    <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>
    Quote Originally Posted by skinsearch.php
    <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.

  • #5
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,647
    Thanks
    2
    Thanked 406 Times in 398 Posts
    Quote Originally Posted by geekgirl101 View Post
    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=javas...indow+location
    Last edited by Spookster; 03-03-2007 at 01:41 AM.

  • #6
    New to the CF scene
    Join Date
    Mar 2007
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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?

  • #7
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,647
    Thanks
    2
    Thanked 406 Times in 398 Posts
    Quote Originally Posted by geekgirl101 View Post
    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:
    PHP Code:
    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():
    PHP Code:
    if(isset($_POST['skinsearch']))
    {
        
    $_POST['skinsearch'] = mysql_real_escape_string($_POST['skinsearch']); 
    Last edited by Inigoesdr; 03-03-2007 at 06:31 PM.

  • #8
    New to the CF scene
    Join Date
    Mar 2007
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Inigoesdr View Post
    When you list the thumbnails in the popup window you would link them using something like this:
    PHP Code:
    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.
    Last edited by geekgirl101; 03-04-2007 at 11:52 AM.

  • #9
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,647
    Thanks
    2
    Thanked 406 Times in 398 Posts
    Quote Originally Posted by geekgirl101 View Post
    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:
    Code:
    <a href="#" onclick="javascript: opener.location.href = 'thumbinfo.php?id=1'; return false;">Click to change parent</a>

  • #10
    New to the CF scene
    Join Date
    Mar 2007
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Inigoesdr View Post
    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:
    Code:
    <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:

    Code:
    +--------+----------+----+----+------------------+
    |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.

  • #11
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,647
    Thanks
    2
    Thanked 406 Times in 398 Posts
    Use results.php?family=dog or whatever then.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •