select

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Alain Dhaene

    select

    Hi,

    I have following problem.

    In a form I have a control lsDocent. I want send the value to another page.
    He send the second parameter 'code' but he send the string lsDocent to the
    other page instead of the value of lsDocent.

    What's wrong with this?

    <form name="verwijder " action="vak_inf o.php?doc=lsDoc ent&&code=<?ech o
    $code?>" method = "post">
    <SELECT name="lsDocent" >
    <?php
    while ($line = mysql_fetch_arr ay($resultaat, MYSQL_ASSOC)) {
    ?>


    <!--
    genereren van lijst van docenten
    -->


    <OPTION selected value="<?print $line["Leraarscod e"];?>"><?print
    $line["Familienaa m"];?> <?print " - "?> <?print
    $line["Voornaam"];?></OPTION>

    <?php
    }
    ?>
    </SELECT>
    </td>
    <td>
    <input type = "submit" Value="OK">
    </td>
    </form>


    </TR>
    ALain


  • Daniel Tryba

    #2
    Re: select

    Alain Dhaene <alain.dhaene@w orldonline.be> wrote:[color=blue]
    > In a form I have a control lsDocent. I want send the value to another page.
    > He send the second parameter 'code' but he send the string lsDocent to the
    > other page instead of the value of lsDocent.
    >
    > What's wrong with this?[/color]

    At first glance nothing (except it quite ugly and inconsistent).
    [color=blue]
    > <form name="verwijder " action="vak_inf o.php?doc=lsDoc ent&&code=<?ech o $code?>" method = "post">[/color]
    ^^ one & to many
    [color=blue]
    > <SELECT name="lsDocent" >[/color]
    [snip][color=blue]
    > <OPTION selected value="<?print $line["Leraarscod e"];?>"><?print
    > $line["Familienaa m"];?> <?print " - "?> <?print
    > $line["Voornaam"];?></OPTION>[/color]

    What's the output of the script? Is the value realy in the row
    'Leraarscode' and not in 'Leraarcode'?

    --

    Daniel Tryba

    Comment

    • Alain Dhaene

      #3
      Re: select

      The output is
      lsDocent and the value of the code e.g A

      In the select box I get a row of Stings (the code of a docent). I thought
      when I select one of them then the value of lsDocent will retrieve this
      value and so I post this value to the other form. But I retrieve the text
      lsDocent.

      Alain

      "Daniel Tryba" <news_comp.lang .php@canopus.nl > schreef in bericht
      news:bpntfr$1bi $2@news.tue.nl. ..[color=blue]
      > Alain Dhaene <alain.dhaene@w orldonline.be> wrote:[color=green]
      > > In a form I have a control lsDocent. I want send the value to another[/color][/color]
      page.[color=blue][color=green]
      > > He send the second parameter 'code' but he send the string lsDocent to[/color][/color]
      the[color=blue][color=green]
      > > other page instead of the value of lsDocent.
      > >
      > > What's wrong with this?[/color]
      >
      > At first glance nothing (except it quite ugly and inconsistent).
      >[color=green]
      > > <form name="verwijder " action="vak_inf o.php?doc=lsDoc ent&&code=<?ech o[/color][/color]
      $code?>" method = "post">[color=blue]
      > ^^ one & to many
      >[color=green]
      > > <SELECT name="lsDocent" >[/color]
      > [snip][color=green]
      > > <OPTION selected value="<?print $line["Leraarscod e"];?>"><?print
      > > $line["Familienaa m"];?> <?print " - "?> <?print
      > > $line["Voornaam"];?></OPTION>[/color]
      >
      > What's the output of the script? Is the value realy in the row
      > 'Leraarscode' and not in 'Leraarcode'?
      >
      > --
      >
      > Daniel Tryba
      >[/color]


      Comment

      • OSIRIS

        #4
        Re: select

        Alain Dhaene wrote:[color=blue]
        > Hi,
        >
        > I have following problem.
        >
        > In a form I have a control lsDocent. I want send the value to another page.
        > He send the second parameter 'code' but he send the string lsDocent to the
        > other page instead of the value of lsDocent.
        >
        > What's wrong with this?
        >
        > <form name="verwijder " action="vak_inf o.php?doc=lsDoc ent&&code=<?ech o
        > $code?>" method = "post">
        > <SELECT name="lsDocent" >
        > <?php
        > while ($line = mysql_fetch_arr ay($resultaat, MYSQL_ASSOC)) {
        > ?>
        >
        >
        > <!--
        > genereren van lijst van docenten
        > -->
        >
        >
        > <OPTION selected value="<?print $line["Leraarscod e"];?>"><?print
        > $line["Familienaa m"];?> <?print " - "?> <?print
        > $line["Voornaam"];?></OPTION>
        >
        > <?php
        > }
        > ?>
        > </SELECT>
        > </td>
        > <td>
        > <input type = "submit" Value="OK">
        > </td>
        > </form>
        >
        >
        > </TR>
        > ALain
        >
        >[/color]
        I think it is an error in the first line:
        <form name="verwijder " action="vak_inf o.php?doc=<? echo $lsDocent;
        ?>&&code=<?ech o
        $code?>" method = "post">
        So you must attribute lsDocent in a php script.

        Comment

        Working...