Guys i am going crazy here I dont know what I am doing wrong here, it renders in blank the page.

I apreciatte very much your help.

Oma

<?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>

Hi Oma,

There's a parse error in your code, you need to remove the extra '}'. I've split up your code so you can see where the error is.

Guys i am going crazy here I dont know what I am doing wrong here, it renders in blank the page.

<?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

You need to remove this '}'.

}
?></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>

Hope this helps.

Adnan

Also you could alter your php.ini file, and change these values to:
error_reporting = E_ALL
display_errors = On

This will show you where the errors are. Although note that "display_errors = On" isn't recommended for production systems and should be Off.

If you prefer not to enable "display_errors" you could look for your web server's error log, as it should be in there too.

Adnan

Adnan thank you for your time, i did the changes you mention above and it render at least now something unfortunately an error but at least is something this:

call to undefined function: check selection() Line30

My webserver is running php5 does it has to do with that

It shouldn't. I see you have a file named functions.php included into your file at the top. Look in that file for the checkSelection function and ensure that it is there. Maybe the casing is incorrect, as function and variable names are case sensitive.

OK guys I am about to scream, damn so here is my entire CODE, i dont have any functions.php file.

The code was given to me, i am trying to have a list/menu and then pass the result to another list/menu dynamically HONESTLY I DONT KNOW what i am doing wrong here. HELP! Thank you very much

<?php

    $dbserver = "MYSERVER.com";
    $user = "USERME";
    $db = "DB2008";
    $pwd = "MYPASS";
    global $link;
    $link = mysql_connect($dbserver,$user,$pwd);
    mysql_select_db($db, $link);


?>


<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="1" 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>
          <br>
          <br>
          <br>
          <br></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>

Well, if you can, try and obtain a copy of functions.php from whomever gave you the code. Apparently there's a function you need and it's missing.

Also, a group of dynamic drop downs like that would be much easier to do with just Javascript that's generated by PHP. Something described in this thread.

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.