Jump to content


Photo

List Boxes


  • Please log in to reply
3 replies to this topic

#1 glenelkins

glenelkins
  • Members
  • PipPipPip
  • Advanced Member
  • 760 posts
  • LocationBridlington - East Riding of Yorkshire - United Kingdom

Posted 08 June 2006 - 01:29 PM

Hi

If i use the following HTML is creates a nice list box:

<select size="3" multiple>
  <option>1</option>
  <option>2</option>
  <option>3</option>
</select>

So why does this not work??:

<select size="3" multiple>
  <?
  for ($i=0;$i<2;$i++) {
    ?>
    <option><? echo $i; ?></option>
    <?
  }
  ?>
</select>

http://thewebsolutionprovider.com - A Solution For Everything Web!

#2 poirot

poirot
  • Members
  • PipPipPip
  • Advanced Member
  • 646 posts
  • LocationAustin, TX

Posted 08 June 2006 - 01:42 PM

I don't know, because it works here. Maybe if you use the conventional start tag (<?php instead of <?) ?

<select size="3" multiple>
  <?php
  for ($i=0;$i<2;$i++) {
    ?>
    <option><?php echo $i; ?></option>
    <?php
  }
  ?>
</select>

In fact I don't like the idea of hopping in and out of PHP:

<select size="3" multiple>
  <?php
  for ($i=0;$i<2;$i++) {
    echo '<option>' . $i . '</option>' . "\n";
  }
  ?>
</select>

Or :

<?php

echo '<select size="3" multiple>';

  for ($i=0;$i<2;$i++) {
    echo '<option>' . $i . '</option>' . "\n";
  }

echo '</select>';

?>

All of them worked here.
~ D Kuang

#3 glenelkins

glenelkins
  • Members
  • PipPipPip
  • Advanced Member
  • 760 posts
  • LocationBridlington - East Riding of Yorkshire - United Kingdom

Posted 08 June 2006 - 01:50 PM

Hi

It actually makes no difference with the <? and <?php tags (at all!!! they are the same)

Its working now, i pasted the code...wierd!! when i type it it does not like it. Unless its my computer adding in invisible characters, iv had that before!!



..and now its working when typed.
http://thewebsolutionprovider.com - A Solution For Everything Web!

#4 .josh

.josh
  • Staff Alumni
  • .josh
  • 14,871 posts

Posted 08 June 2006 - 04:35 PM

[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]
It actually makes no difference with the <? and <?php tags (at all!!! they are the same)
[/quote]
actually, they are different. not all servers support
<?
if your server supports it, fine and dandy, but say you wanna move to a new server, and guess what, it doesn't support it. since you like hopping in and out of php, you'd have an awful lot of editing to do...
Did I help you? Feeling generous? Buy me lunch! 
Please, take the time and do some research and find out how much it would have cost you to get your help from a decent paid-for source. A "roll-of-the-dice" freelancer will charge you $5-$15/hr. A decent entry level freelancer will charge you around $15-30/hr. A professional will charge you anywhere from $50-$100/hr. An agency will charge anywhere from $100-$250/hr. Think about all this when soliciting for help here. Think about how much money you are making from the work you are asking for help on. No, we do not expect you to pay for the help given here, but donating a few bucks is a fraction of the cost of what you would have paid, shows your appreciation, helps motivate people to keep offering help without the pricetag, and helps make this a higher quality free-help community :)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users