Jump to content

julian9876

New Members
  • Posts

    4
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

julian9876's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. hello.... I'm stuck... I'm trying to populate a check box with a 2d array. I have made three arrays within one array, but when i run it, nothing appears.. here is the code i have used so far: <legend>Optional extras</legend> <optgroup label="Entertainment"> <?php foreach($car_extras as $car_extras_id => $extras) { echo '.$car_extras_id.'; { foreach($extras as $entertainment) $i++; echo '<input type=checkbox name="options" value="'.$extras.'" id="entertainment'.$num[$i].'"/>'; echo '<label for ="entertainment'.$num[$i].'">'.$entertainment.'</label><br/>'; } } ?> This is the array code $car_extras = array ("Entertainment"=>array("6 disc DVD changer", "TV function", "DAB digital radio", "Loudspeaker system - professional", "Multimedia navigation system"), "Communication"=>array("Universal remote control", "Voice control", "Navigation system","Head-up display"), "Safety & Security"=>array("Adaptive headlights", "Night vision with pedestrian recognition", "Run-flat tyres")); Thanks for the help!
  2. Done it!! if( is_array($car_extras)) { while (list ($key, $val) = each ($car_extras)) { if($val==0){echo("6 disc DVD changer");} elseif($val==1){echo("TV function<br />");} elseif($val==2){echo("DAB digital radio<br />");} elseif($val==3){echo("Loudspeaker system - professional<br />");} elseif($val==4){echo("Multimedia navigation system<br />");} elseif($val==5){echo("Universal remote control<br />");} elseif($val==6){echo("Voice control<br />");} elseif($val==7){echo("Navigation system<br />");} elseif($val=={echo("Head-up display<br />");} elseif($val==9){echo("Adaptive headlights<br />");} elseif($val==10){echo("Night vision with pedestrian recognition<br />");} elseif($val==11){echo("Run-flat tyres<br />");} } } Thanks anyway!!!!
  3. This is the listbox: <fieldset> <legend>Optional extras</legend> <select class="select" id="extras" name="options[]" multiple="multiple" size="6"> <optgroup label="Entertainment"> <option value="1">6 disc DVD changer</option> <option value="2">TV function</option> <option value="3">DAB digital radio</option> <option value="4">Loudspeaker system - professional </option> <option value="5" title="Multimedia navigation system. Uses advanced audio technology">Multimedia navigation system</option> </optgroup> <optgroup label="Communication"> <option value="6">Universal remote control</option> <option value="7">Voice control</option> <option value="8">Navigation system</option> <option value="9">Head-up display</option> </optgroup> <optgroup label="Safety and Security"> <option value="10">Adaptive headlights</option> <option value="11">Night vision with pedestrian recognition</option> <option value="12">Run-flat tyres</option> </optgroup> </select> </fieldset> Only code i have for the php: if( is_array($car_extras)) { while (list ($key, $val) = each ($car_extras)) { echo "$val <br>"; }
  4. Hello.... I have a form that has a multiple select list box on it... When i display all the data from the list box, all i get is the number of the option that i have selected. Does anyone know how to change the value from a number to a name??? Julian
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.