php - create a select list with all the values in it rather than 1 select list with 1 value -


i using drupal 6 , trying fill select list values @ point can make 1 select list 1 value values in field. want values produce in field in 1 select list

on top of trim | character. ti has portion of field rather whole thing.

here have need modify trims option value , produces 1 select list has values in it.

<?php   foreach ($field_reservations $rfield) {  echo '<select id="test">';  echo '<option value="' .$rfield[value]. '">';  echo $rfield[value]. '</option> <br><br>';  echo '</select> '; } ?> 

i can provide info helpful

to have 1 select list echo opening select tag before loop , closing select tag after loop. use strpos find position of | , substr text left , right of |

echo '<select id="test">'; foreach ($field_reservations $rfield) {     $pos = strpos($rfield['value'], '|');     $value = substr($rfield['value'], 0, $pos - 1);     $display = substr($rfield['value'], $pos + 1);     echo '<option value="'.$value.'">'.$display.'</option>'; } echo '</select>'; 

Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -