Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

pull-down menus. how to output the selected value?


Guest

Recommended Posts

i've got a custom pull-down menu that presently works.

 

when i go to edit a page, the "default" selection is always selected.. even if there is a different value in the saved database.

 

defining the menu..

	$pulldown = array(array('id' => 'bluewidget', 'text' => 'bluewidget'), 
		array('id' => 'pinkwidget, 'text' => 'pinkwidget'));

 

output

$contents[] = array('text' => '<br>' . TEXT_MANUFACTURERS_COLOR . '<br>' . tep_draw_pull_down_menu('colorgroup', $pulldown));

 

 

notice "bluewidget" is the first selection. regardless if i have pinkwidget saved... bluewidget always shows on the edit page.

 

if blue widget is NOT the value saved, how can i output the actual value?

i know of course, i can achieve this with dozens of if statements, but it is my preference to do something less messy. :) if possible.

Link to comment
Share on other sites

if blue widget is NOT the value saved, how can i output the actual value?

From the function declaration the actual value should be the third parameter to have that selected.

 function tep_draw_pull_down_menu($name, $values, $default = '', $parameters = '', $required = false) {

That is used in admin/categories.php for example:

tep_draw_pull_down_menu('manufacturers_id', $manufacturers_array, $pInfo->manufacturers_id)

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...