i know this maybe to easy for you, this is what i need to accomplish:

2 list menus

1.- Manufacturer (Honda, Kawa, Susuki)
2.- Model (cr250, cr125,etc..) each manufacturer has their own models
3.- Year(1999.1998,etc..)

So i would like to have the first list menu listing the manufacturers options and when the user click on one another list menu will show or appear or maybe a submit button and then it will populate the MODEL info and the the YEAR, at the end will show a single line of text which will be the part number of the produc

i.e

1.- Manufacturer = Honda
2.- Model = cr250
3.- Year = 1999

Result = Part Number:KHND99

thank you!!

Recommended Answers

All 2 Replies

use PHP String Functions to do this...
take a look at this

I got this code from someone that was helping me but i guess he decide not anymore, i am missing the functions.php file i never receive it, here is the code it was given to me:

But i can't make it work, it renders blank!!!!

<?php


//include("functions.php");
//dbConnect();
//ADD YOUR OWN DB CONNECTION HERE

?>

<html>

    <head>
        <meta http-equiv="content-type" content="text/html;charset=utf-8" />
        <meta name="generator" content="Adobe GoLive" />
        <title>cr1_search</title>
    </head>

    <body>
        <table border="0" cellspacing="0" cellpadding="10">
            <tr>
            <FORM name="search" METHOD="POST" >
                   
        <td align="left" valign="middle"><select name="application" size="1"
onchange="this.form.submit()">
<option value="" <?php checkSelection($application,"");?>>- Select -</option><?php $sql = "SELECT * FROM application ORDER BY application_name"; $result = mysql_query($sql); while ($row = mysql_fetch_array($result)) {
$sql1 = "SELECT count(*) AS num_results FROM model WHERE suspension_id LIKE '%$row[application_id]%' ";
$result1 = mysql_query($sql1);
$count = mysql_fetch_array($result1);
$num_of_results = $count[num_results];
                   
?>
<option value="<?=$row['application_id']?>" <?php checkSelection($_POST['application'],$row['application_id']);?>><?=$row['app
lication_name'].' ('.$num_of_results.')';?></option><?php } ?>
                                                            </select></td>
                <td align="left" valign="middle"><?PHP if ($_POST[application] != '') { ?><select name="manufacturer" size="1" onchange="this.form.submit()">
                            <option value="" <?php
checkSelection($manufacturer,"");?>>- Select -</option><?php //$sql = "SELECT DISTINCT manufacturer.manufacturer_name,manufacturer.manufacturer_id FROM manufacturer,product WHERE manufacturer.manufacturer_id = product.manufacturer_id AND product.application_id LIKE '%$_POST[application]%' ORDER BY manufacturer_name"; $sql = "SELECT * FROM manufacturer ORDER BY manufacturer_name"; $result = mysql_query($sql); while ($row = mysql_fetch_array($result)) {
$sql1 = "SELECT count(DISTINCT model_name) AS num_results FROM model WHERE manufacturer_id LIKE '%$row[manufacturer_id]%' AND suspension_id = '$_POST[application]' ";
$result1 = mysql_query($sql1);
$count = mysql_fetch_array($result1);
$num_of_results = $count[num_results];
                   
                                    ?>
                            <option value="<?=$row['manufacturer_id']?>"
<?php
checkSelection($_POST['manufacturer'],$row['manufacturer_id']);?>><?=$row['m
anufacturer_name'].' ('.$num_of_results.')';?></option><?php } ?>
                        </select><?PHP
}

?></td>
                    <td align="left" valign="middle"><?PHP if ($_POST[manufacturer] != '' AND $_POST[application] != '') { ?><select name="model" size="1" onchange="this.form.submit()">
                            <option value="" <?php
checkSelection($model,"");?>>- Select -</option><?php $sql = "SELECT DISTINCT model_name FROM model WHERE manufacturer_id = '$_POST[manufacturer]' AND suspension_id = '$_POST[application]'  ORDER BY model_name"; $result = mysql_query($sql); while ($row = mysql_fetch_array($result)) {
//$sql1 = "SELECT count(*) AS num_results FROM product WHERE model_id LIKE '%$row[model_id]%' ";
//$result1 = mysql_query($sql1);
//$count = mysql_fetch_array($result1);
//$num_of_results = $count[num_results];
                   
                                    ?>
                            <option value="<?=$row['model_name']?>" <?php checkSelection($_POST['model'],$row['model_name']);?>><?=$row['model_name'];
?></option><?php } ?>
                        </select><?PHP
}
?></td>
                    <td align="left" valign="middle"><?PHP if ($_POST[manufacturer] != '' AND $_POST[application] != ''AND $_POST[model] != '') { ?><select name="year" size="1" onchange="this.form.submit()">
                            <option value="" <?php
checkSelection($year,"");?>>- Select -</option><?php $sql = "SELECT year_name,model_id FROM model WHERE model_name = '$_POST[model]' ORDER BY year_name"; $result = mysql_query($sql); while ($row = mysql_fetch_array($result)) {
//$sql1 = "SELECT count(*) AS num_results FROM product WHERE year_id LIKE '%$row[year_id]%' ";
//$result1 = mysql_query($sql1);
//$count = mysql_fetch_array($result1);
//$num_of_results = $count[num_results];
                   
                                    ?>
                            <option value="<?=$row['model_id']?>" <?php checkSelection($_POST['year'],$row['model_id']);?>><?=$row['year_name'];?></
option><?php } ?>
                        </select><?PHP
}
?></td>
                </FORM></tr>
        </table>
        <?PHP
if ($_POST[year] != '') {

$sql2 = "SELECT * FROM product WHERE model_id LIKE '%$_POST[year]%' ";
$result2 = mysql_query($sql2);
if ($result2 == TRUE) {
while ($info = mysql_fetch_array($result2)) {

?>
        <table width="180" border="1" cellspacing="2" cellpadding="0">
            <tr>
                <td>Image</td>
                <td>Description</td>
                <td>Option</td>
            </tr>
            <tr>
                <td><a title="<?=$info['product_name']?>"
href="<?=$info['large_pic']?>" target="_new"><img
src="<?=$info['small_pic']?>"   border="0"></a></td>
                <td><?=$info['product_name'];?></td>
                <td></td>
            </tr>
        </table>
        <?PHP
}
}
if ($result2 == FALSE) {
$search_error = "Sorry no products are currently available for your search."; }

}
?><?=$search_error;?>
    </body>

</html>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.