Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Variable Help


JSeifert1

Recommended Posts

I have created three drop down boxes on my page the second drop down will manipulate the contents of the third. Each one reloads the page. Is there a way I can get the boxes to retain the selections made, so that I can use the selections to modify the product listing?

 

My page url is www.2xpc.com

 

Here is the code I have. Most will notice it is just a modification of the manufacturers.php file included with oscommerce. I am very new to php and oscommerce, and this is my first attempt at doing this. So, please bear with me.

 

Thanks in advance

 

<?php

?>

<!-- vehicle_search //-->

<tr>

<td>

<?php

$info_box_contents = array();

$info_box_contents[] = array('align' => 'left',

'text' => "Vehicle Search");

new infoBoxHeading($info_box_contents, false, false);

 

$vehicle_query = tep_db_query("select vehicle_year_id, vehicle_year from " . vehicle_years . " order by vehicle_year_id");

 

// Display drop-down 1

$select_box = '<select name="vehicle_year_id" onChange="this.form.submit();" size="' . MAX_YEARS_LIST . '" style="width: 100%">';

if (MAX_YEARS_LIST < 2) {

$select_box .= '<option value="">' . 'Vehicle Year' . '</option>';

}

while ($years_values = tep_db_fetch_array($vehicle_query)) {

$select_box .= '<option value="' . $years_values['vehicle_year_id'] . '"';

if ($HTTP_GET_VARS['vehicle_year_id'] == $years_values['vehicle_year_id']) $select_box .= ' SELECTED';

$select_box .= '>' . $years_values['vehicle_year'] . '</option>';

}

$select_box .= "</select>";

$select_box .= tep_hide_session_id();

 

$info_box_contents = array();

$info_box_contents[] = array('form' => '<form name="vehicleyears" method="get" action="' . tep_href_link(FILENAME_DEFAULT, '', 'NONSSL', false) . '">',

'align' => 'left',

'text' => $select_box);

 

new infoBox($info_box_contents);

 

$vehicle_make_query = tep_db_query("select vehicle_make_id, vehicle_make from " . vehicle_make . " order by vehicle_make");

 

// Display drop-down 2

$select_box1 = '<select name="vehicle_make_id" onChange="this.form.submit(); " size="' . MAX_MAKES_LIST . '" style="width: 100%">';

if (MAX_MAKES_LIST < 2) {

$select_box1 .= '<option value="">' . 'Vehicle Make' . '</option>';

}

while ($make_values = tep_db_fetch_array($vehicle_make_query)) {

$select_box1 .= '<option value="' . $make_values['vehicle_make_id'] . '"';

if ($HTTP_GET_VARS['vehicle_make_id'] == $make_values['vehicle_make_id']) {

$select_box1 .= ' SELECTED';

$make_id = $make_values['vehicle_make_id'];

}

$select_box1 .= '>' . $make_values['vehicle_make'] . '</option>';

}

$select_box1 .= "</select>";

$select_box1 .= tep_hide_session_id();

 

$info_box_contents = array();

$info_box_contents[] = array('form' => '<form name="vehiclemake" method="get" action="' . tep_href_link(FILENAME_DEFAULT, '', 'NONSSL', false) . '">',

'align' => 'left',

'text' => $select_box1);

 

new infoBox($info_box_contents);

 

if ($make_id != $make_values['vehicle_make_id']) {

$vehicle_model_query = tep_db_query("select vehicle_model_id, vehicle_model from " . vehicle_model . " where vehicle_make_id = " . $make_id);

} else {

$vehicle_model_query = tep_db_query("select vehicle_model_id, vehicle_model from " . vehicle_model . " order by vehicle_model");

}

 

// Display drop-down 3

$select_box2 = '<select name="vehicle_model_id" onChange="this.form.submit();" size="' . MAX_MODELS_LIST . '" style="width: 100%">';

if (MAX_MODELS_LIST < 2) {

$select_box2 .= '<option value="">' . 'Vehicle Model' . '</option>';

}

while ($model_values = tep_db_fetch_array($vehicle_model_query)) {

$select_box2 .= '<option value="' . $model_values['vehicle_model_id'] . '"';

if ($HTTP_GET_VARS['vehicle_model_id'] == $model_values['vehicle_model_id']) $select_box2 .= ' SELECTED';

$select_box2 .= '>' . $model_values['vehicle_model'] . '</option>';

}

$select_box2 .= "</select>";

$select_box2 .= tep_hide_session_id();

 

$info_box_contents = array();

$info_box_contents[] = array('form' => '<form name="vehiclemodel" method="get" action="' . tep_href_link(FILENAME_DEFAULT, '', 'NONSSL', false) . '">',

'align' => 'left',

'text' => $select_box2);

 

new infoBox($info_box_contents);

 

?>

</td>

</tr>

<!-- vehicle_search_eof //-->

Link to comment
Share on other sites

  • 6 months later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...