Results 1 to 6 of 6

Thread: Autoselect car manufactured and models from database

  1. #1
    Join Date
    Mar 2004
    Posts
    7

    Lightbulb Autoselect car manufactured and models from database

    Hi friends, this is a good mod realeased from Giacomo Carriello and Andrea Urbani , that I have paid for the realization .
    Emanuele

    FILE - LISTINGSEARCH.PHP

    ---------------------------------------------------------------
    <STYLE>
    <!--
    BODY {
    Scrollbar-Face-Color:#FFFFFF;
    Scrollbar-Arrow-Color:#666666;
    Scrollbar-Base-Color:transparency;
    Scrollbar-Shadow-Color:#CCCCCC;
    Scrollbar-Dark-Shadow-Color:#FFFFFF;
    Scrollbar-Highlight-Color:#FFFFFF;
    Scrollbar-3D-Light-Color:#006600;
    background-color: transparency;
    }
    -->
    </STYLE></style>

    <?php
    // Autoselect Car Manufacture and models from Database. // Mod by : Giacomo Carriello, Andrea Urbani. // :-) Executive producer :Emanuele Marchiori
    include("include/common.php");
    include("$config[template_path]/user_top.html");
    global $conn;

    function get_models($make)
    {
    global $conn;
    $models = array();
    $query="SELECT listing_id FROM default_listingsDBElements WHERE field_name='Manufacturer' and field_value = '" . $make . "'";
    $result=$conn->Execute($query);
    while(!$result->EOF)
    {
    array_push($models, $result->fields[0]);
    $result->MoveNext();
    }
    return($models);
    }
    ?>
    <table border="<?php echo $style[admin_listing_border] ?>" align="left" cellpadding="0" cellspacing="<?php echo $style[admin_listing_cellspacing] ?>" class="form_main">
    <tr>
    <td width="1"></td>
    <td width="240" valign="top">
    <h3 align="center"><font size="3" face="Geneva, Arial, Helvetica, sans-serif">CARS ......</font></h3>
    <h4 align="center"><font size="1" face="Arial, Helvetica, sans-serif" color="#FFFFFF"><strong>Search:</strong></font></h4>
    <table cellpadding="5" cellspacing="0">
    <tr>
    <td><font size="1" face="Arial, Helvetica, sans-serif" color="#FFFFFF"><strong>Manufacturer:</strong></font></td>
    <td>
    <form name="search" action="<?=$PHP_SELF?>" method="POST">
    <select name="make" onchange="this.form.submit()">
    <option>Scegli</option>
    <?php
    $query="SELECT DISTINCT field_value FROM default_listingsDBElements WHERE field_name = 'Manufacturer' ORDER BY field_value";
    $result=$conn->Execute($query);
    while(!$result->EOF)
    {
    $make = $result->fields[0];
    echo "<option ";
    if($make == $_POST['make']) echo "selected ";
    echo "name=\"$make\">$make</option>\n";
    $result->MoveNext();
    }
    ?>
    </select></td></tr>
    <tr><td><font size="1" face="Arial, Helvetica, sans-serif" color="#FFFFFF"><strong>Model:</strong></font></td>
    <td><select name="model" onchange="this.form.submit()">
    <option>Scegli</option>
    <?php
    if($_POST['make'])
    {
    $models = get_models($_POST['make']);
    $query="SELECT DISTINCT field_value FROM default_listingsDBElements WHERE field_name = 'Model' AND listing_id IN (" . join(', ', $models) . ") ORDER BY field_value";
    $result=$conn->Execute($query);
    while(!$result->EOF)
    {
    $model = $result->fields[0];
    echo "<option ";
    if($model == $_POST['model']) echo "selected ";
    echo "name=\"$model\">$model</option>\n";
    $result->MoveNext();
    }
    }
    ?>
    </select></form></td></tr>
    <tr><td colspan="2"><font size="1" face="Arial, Helvetica, sans-serif" color="#FFFFFF"></td>
    </table>
    <form name="search" action="listing_browse.php" method="GET">

    <?php if($_POST['make']) { ?>
    <input type="hidden" name="Manufacturer" value="<?php echo $_POST['make']; ?>">
    <?php }
    if($_POST['model']) { ?>
    <input type="hidden" name="model" value="<?php echo $_POST['model']; ?>">
    <?php } ?>
    <input type="submit" value="Search">
    </form>
    </td>
    </tr>
    </table>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <div align="center"></div>
    <?php include("$config[template_path]/user_bottom.html"); ?>
    Last edited by thebeards; 08-10-2004 at 12:40 PM.

  2. #2
    Join Date
    Apr 2004
    Location
    San Diego
    Posts
    32

    Thumbs up This mod is tight

    I love this mod. thanks "thebeards" I tried creating this mod, but I am new to PHP. Thanks for posting it. You think is possible to still add the number of vehicles for each make, and the number of vehicles for each model. i.e

    make:
    Ford (3)

    once the person selects "Ford"

    model:
    Mustang (2)

    etc.

    If anybody knows how to do this, don't be shy and hook it up!.
    "My theory is that if you look confident you can pull off anything - even if you have no clue what you're doing…" Unknown

  3. #3
    Join Date
    Jan 2004
    Location
    Houston,TX
    Age
    53
    Posts
    80

    Default Incorporate this into listingsearch

    Hello all,

    Can someone give me a clue about how to incorporate this mod into listingsearch. Or to include the listingsearch stuff into this. This seems like it would be a great addition to the auto related sites.

    This mod works great standalone. When a vehicle make is selected, it reloads the page with only the models for that make in the models selection box.

    I am interested in this to provide a way to search for a specific model with all the other choices offered by listingsearch.

    I realize I could just make models a searchable field from listings template editor. But it wouldn't tie the models choices to the manufactures selection.

    I can elaborate further if needed.
    Regards,
    Will

    --------------------------------------------------

    What if the hokey-pokey really is what it's all about?

  4. #4
    Join Date
    Mar 2005
    Posts
    7

    Default reselect query

    Did anyone allready use such reselect query in de OR system?

    this would be one of the best MOD's of the OR system!

    Example for real estate:

    All estates: 2000

    First select: State => 200 left
    Then select: Provence: 15 left
    Select Village / Town: 2 left

    Show the stuff!

    Something like that.... who did program this? Or how to program it in PHP?

  5. #5
    Join Date
    Aug 2004
    Posts
    2

    Default The Same Mod for 2.0

    Hello Friends,

    Please help me out. Im making an auto website.

    I want to place only 1 field to the top

    This is how I want it to be:
    Search by Make:
    (search by make field)
    Go Button

    Also, I want the search box like this:
    http://www.freeasphost.co.uk/4mmania...h-example.jpg\

    would be great if I can get a reply from you people.

    Thanks.
    Attached Images Attached Images

  6. #6
    Join Date
    Nov 2006
    Posts
    8

    Default Re: Autoselect car manufactured and models from database

    Maybe someone who uses this mod count post a little explanation how to use it!!!

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
  •