1

I am building a user form and I am using php for the values of the form.

    <select id="customerInput" name="customerId" style="width:300px"> 
        <?  foreach (array_slice($customers, 1) as $row) { ?>
        <option value="<? echo $row['CustomerID']; ?>"> <? echo $row['Name'];  ?> </option> <? } ?>
    </select>

Hopefully you can see what I am trying to do...I want the options value to be the customer ID and the writing in the field the customer Name.

When I run this the and view the source, the php is commented out etc and does not work

I am not sure why...Any ideas?

Butterflycode
  • 759
  • 2
  • 10
  • 23

1 Answers1

2

Try this (Changing <? to <?php ):

<select id="customerInput" name="customerId" style="width:300px"> 
        <?php 
          foreach (array_slice($customers, 1) as $row) { ?>
             <option value="<?php echo $row['CustomerID']; ?>"> <?php echo $row['Name'];  ?> </option>
       <?php } ?>
</select>
Abu Romaïssae
  • 3,841
  • 5
  • 37
  • 59