You could have if statements for every option.
May be better if you have a for loop for some of the options -- SEE BELOW.


<TR><TD><B><?php echo("cell name")?>:</B></TD>
<TD><select name="cellname">

        //Do some database stuff (connect, query, get result etc etc) to get
the value that is stored. Put the number into the variable $var

    for ($i=1904;$i<1912;$i++)
              printf("<option value='%s'",$i);
              if ($var == $i)
                  printf(" selected");
              printf("> %s</option>",$i);
              printf("<option value='1916'");
              if ($var == '1916')
                  printf(" selected");
              printf("> 1916</option>");

              printf("<option value='volta'");
              if ($var == 'volta')
                  printf(" selected");
              printf("> volta</option>");

              printf("<option value='scatt11'");
              if ($var == 'scatt11')
                  printf(" selected");
              printf("> scatt11</option>");


"Walid Dib" <[EMAIL PROTECTED]> wrote in message
> Hello, I need to  get back the present value in the data base and to
> post(show) it in the menu of selection.  somebody has an idea??
> Thank you in advance.
> <TR><TD><B><?php echo("cell name")?>:</B></TD>
>   <TD><select name="cellname">
>               <option value="1904" selected> 1904</option>
>               <option value="1905"> 1905</option>
>               <option value="1906"> 1906</option>
>               <option value="1907"> 1907</option>
>               <option value="1908"> 1908</option>
>               <option value="1909"> 1909</option>
>               <option value="1910"> 1910</option>
>               <option value="1911"> 1911</option>
>               <option value="1916"> 1916</option>
>               <option value="volta"> volta</option>
>               <option value="scatt11"> scatt11</option>
>       </select>
> </TD></TR>

PHP Database Mailing List (
To unsubscribe, visit:

Reply via email to