SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Addict
    Join Date
    Jan 2007
    Posts
    296
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Checking for a submit value from a submit button

    I have a form where when a user clicks on submit it brings up some database results.

    Within these results I would like to have a link which when clicks opens up further product information, but still keeps the original results which are displayed when the user clicks the submit button.

    The form which starts it all off

    Code:
    <form action="printstock.php" method="get" class="printstockform">
    <select name="printedmaterial" class="printstockselect">
    <option value="Catalogues">Catalogues</option>
    <option value="iandm">Installation &amp; Maintenance</option>
    </select>
    <input type="image" name="submit" value="Submit" src="images/design-images/view-products.jpg" class="printstockformimage"/>
    </form>
    This then brings up the following results

    Code:
    <?php
    if (isset($_GET['submit'])) {
    $category = $_GET[printedmaterial];
    
    $query = "SELECT * FROM products where category = '$category'";
    $results = mysql_query($query) or die(mysql_error());
    
    ?>
    <table class="printstockproductstable">
    <!--
    <table class="printstockproductstable">
    <tr><th>Product Description</th><th>Further Details</th></tr>
    -->
    <?php
    
    //extract the results into variables and then passing the prodnum across to the next page via the url
    while ($row = mysql_fetch_array($results)) {
    extract ($row);
    echo "<td>" . "<a href = 'printstock.php?prodid=" . $prodnum . "&click=" . yes . "&submit=" . submit ."'>" . '<img src="' .$image_thumb .'">' . "</td>";
    echo "<td>" . "<a href = 'printstock.php?prodid=" . $prodnum ."'>  $proddesc </td></tr>";
         }
    }
    
    /*<a href="cottagedetails.php?cottageid=' . rawurlencode($row['Cottage_ID']). '&locationid=' . rawurlencode($row['Location_ID']). '">*/
    ?>
    
    <td>
    </tr>
    </table>
    Now if you look at the first link I am trying to get it so that if someone clicks this link then the original results still stay on the screen but the additional appears on the right hand side of the screen.

    is this possible??

  2. #2
    hi galen's Avatar
    Join Date
    Jan 2006
    Location
    New Haven, CT
    Posts
    1,228
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm guessing you have a list of items and when one of them is clicked you want extra info to appear on the page.

    If im correct then you have 2 options...

    1. Load all the info onto the page but make it display:none. When a link is clicked you show just that products info via javascript (link's id will be related to info container's id). This won't be a good idea if you have a lot of information.

    2. Use ajax to retrieve only the product information you need. Jquery makes ajax calls very easy.

  3. #3
    SitePoint Zealot stuffedbuggy's Avatar
    Join Date
    Sep 2008
    Posts
    187
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you could store them in a temporary session for redisplay.
    You know you cooler than me...


Bookmarks

Posting Permissions

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