I'm going to take a leap and make an assumption that what you want to end up
with is a select list of model names. I'm not sure what the value should be,
whether you want the value returned to you to be the $index the model or the
$element value. You can adjust either way. (By the way, you don't need to
set $InputString at all in this loop, you could just use $element.)

<select name="model" class="gform" onchange="model_jump('parent', this)">
       <option value="0"></option>
  <?
  foreach ($nav_model_names as $index => $element) {
        $InputString = "$element";
         echo "<option value="$InputString">$InputString</option>\n";
           }
         ?>
      </select>

Hope that helps.
Steve

----- Original Message ----- 
From: "Phpu" <[EMAIL PROTECTED]>
To: "Steve Douville" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Thursday, June 17, 2004 9:26 AM
Subject: Re: [PHP] Problems with arrays


> Here is the code:
>
> <select name="model" class="gform" onchange="model_jump('parent', this)">
>        <option value="0">
>   <?
>   foreach ($nav_model_names as $index => $element) {
>         $InputString = "$element";
>          echo "$InputString";
>            }
>          ?></option>
>       </select>
>
>
> ----- Original Message -----
> From: "Steve Douville" <[EMAIL PROTECTED]>
> To: "Phpu" <[EMAIL PROTECTED]>
> Cc: <[EMAIL PROTECTED]>
> Sent: Thursday, June 17, 2004 4:23 PM
> Subject: Re: [PHP] Problems with arrays
>
>
> > Can you give us the code from <select> to </select>?
> > ----- Original Message -----
> > From: "Phpu" <[EMAIL PROTECTED]>
> > To: "Steve Douville" <[EMAIL PROTECTED]>
> > Cc: <[EMAIL PROTECTED]>
> > Sent: Thursday, June 17, 2004 9:14 AM
> > Subject: Re: [PHP] Problems with arrays
> >
> >
> > > I want the element of the array to be displayed in a <select> field
> > >
> > >
> > >
> > > ----- Original Message -----
> > > From: "Steve Douville" <[EMAIL PROTECTED]>
> > > To: "Phpu" <[EMAIL PROTECTED]>
> > > Cc: <[EMAIL PROTECTED]>
> > > Sent: Thursday, June 17, 2004 4:12 PM
> > > Subject: Re: [PHP] Problems with arrays
> > >
> > >
> > > > What are you outputting? html, text, email body...??
> > > > ----- Original Message -----
> > > > From: "Phpu" <[EMAIL PROTECTED]>
> > > > To: "Oliver Hankeln" <[EMAIL PROTECTED]>
> > > > Cc: <[EMAIL PROTECTED]>
> > > > Sent: Thursday, June 17, 2004 9:06 AM
> > > > Subject: Re: [PHP] Problems with arrays
> > > >
> > > >
> > > > > I've tried this but it is not working ...
> > > > >
> > > > > Thanks anyway
> > > > > ----- Original Message -----
> > > > > From: "Oliver Hankeln" <[EMAIL PROTECTED]>
> > > > > To: <[EMAIL PROTECTED]>
> > > > > Sent: Thursday, June 17, 2004 4:04 PM
> > > > > Subject: Re: [PHP] Problems with arrays
> > > > >
> > > > >
> > > > > > Phpu wrote:
> > > > > >
> > > > > > > Hi,
> > > > > > >
> > > > > > > I have this array:
> > > > > > >
> > > > > > > $array = array(element1, element2, element3, element4)
> > > > > > >
> > > > > > > I want to list all elements of this array, so i used:
> > > > > > >
> > > > > > >   foreach ($array as $index => $element) {
> > > > > > >         $InputString = "$element";
> > > > > > >          echo "$InputString";
> > > > > > >            }
> > > > > > >
> > > > > > > but this code lists the elements like this: element1 element2
> > > element3
> > > > > element4
> > > > > > >
> > > > > > > How can i list my elements like this:
> > > > > > > element1
> > > > > > > element2
> > > > > > > element3
> > > > > > > element4
> > > > > >
> > > > > > That's not a problem with arrays. This is one with outputting.
You
> > > need
> > > > > > to add a newline to your echo Statement. Either echo
> "$InputString\n
> > ";
> > > > > > or echo "$InputString<br>"; depending on wether you use html or
> > plain
> > > > > text.
> > > > > >
> > > > > > Oliver
> > > > > >
> > > > > > --
> > > > > > PHP General Mailing List (http://www.php.net/)
> > > > > > To unsubscribe, visit: http://www.php.net/unsub.php
> > > > > >
> > > > >
> > > > > --
> > > > > PHP General Mailing List (http://www.php.net/)
> > > > > To unsubscribe, visit: http://www.php.net/unsub.php
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > >
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> > >
> > >
> > >
> > >
> >
>
>
>
>
>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to