how to automatically display from a list box?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • cricketunes@yahoo.com

    how to automatically display from a list box?

    Hi Folks,
    I am working on a PHP/HTML form which supports End User queries.

    I need the user to select a combination of Airline and corresponding
    place of Origin. i,e
    Delta - Madison, Dallas, Atlanta
    KLM - Amsterdam, Houston, Detroit
    Brit - New York, London, Seattle

    I have a list of Airlines in a list box. The moment the user selects an
    Airline(Delta) from the List box, the list box below it needs to have
    (Dallas, Atlanta, Madison) as its options.

    How is this done? How do I use a listbox selection as a trigger an
    automatically start the next activity?

    Thanks
    Newbie to webdesign.

  • Goran Ljubej

    #2
    Re: how to automatically display from a list box?

    cricketunes@yah oo.com wrote:[color=blue]
    > Hi Folks,
    > I am working on a PHP/HTML form which supports End User queries.
    >
    > I need the user to select a combination of Airline and corresponding
    > place of Origin. i,e
    > Delta - Madison, Dallas, Atlanta
    > KLM - Amsterdam, Houston, Detroit
    > Brit - New York, London, Seattle
    >
    > I have a list of Airlines in a list box. The moment the user selects an
    > Airline(Delta) from the List box, the list box below it needs to have
    > (Dallas, Atlanta, Madison) as its options.
    >
    > How is this done? How do I use a listbox selection as a trigger an
    > automatically start the next activity?
    >
    > Thanks
    > Newbie to webdesign.
    >[/color]
    in my opinion the only way to do this without refreshing is using
    javascript funcion....

    Comment

    • cricketunes@yahoo.com

      #3
      Re: how to automatically display from a list box?

      But how does Javascript connect to the database and pull out the
      corresponding values into the listbox?? can u pass PHP info to
      Javascript?

      Comment

      • Micha³ Wo¼niak

        #4
        Re: how to automatically display from a list box?

        One quick glance of an experienced eye allowed to understand the blurred
        and almost unreadable cricketunes@yah oo.com's handwriting:
        [color=blue]
        > But how does Javascript connect to the database and pull out the
        > corresponding values into the listbox?? can u pass PHP info to
        > Javascript?[/color]

        <SCRIPT language='javas cript'>
        myJavaScriptVar =<?php echo $my_php_var ?>;
        </SCRIPT>

        And there you have it = your PHP variable gets "assigned" to javascript's
        variable. :)

        Cheers
        Mike

        Comment

        • Geoff Berrow

          #5
          Re: how to automatically display from a list box?

          I noticed that Message-ID:
          <1113710549.478 602.217310@g14g 2000cwa.googleg roups.com> from
          cricketunes@yah oo.com contained the following:
          [color=blue]
          >But how does Javascript connect to the database and pull out the
          >correspondin g values into the listbox?? can u pass PHP info to
          >Javascript?[/color]

          You've seen how is done. The idea is to load up all the information
          into Javascript variables at the beginning. From then on everything is
          done client side.

          But you'll need to think of an alternative method for people who don't
          have Javascript enabled

          --
          Geoff Berrow (put thecat out to email)
          It's only Usenet, no one dies.
          My opinions, not the committee's, mine.
          Simple RFDs http://www.ckdog.co.uk/rfdmaker/

          Comment

          • cricketunes@yahoo.com

            #6
            Re: how to automatically display from a list box?


            Geoff Berrow wrote:[color=blue]
            > I noticed that Message-ID:
            > <1113710549.478 602.217310@g14g 2000cwa.googleg roups.com> from
            > cricketunes@yah oo.com contained the following:
            >[color=green]
            > >But how does Javascript connect to the database and pull out the
            > >correspondin g values into the listbox?? can u pass PHP info to
            > >Javascript?[/color]
            >
            > You've seen how is done. The idea is to load up all the information
            > into Javascript variables at the beginning. From then on everything[/color]
            is[color=blue]
            > done client side.[/color]
            Thanks Geoff and Mike :-)
            Can i Interject my PHP code with javascript blocks?

            Comment

            • Geoff Berrow

              #7
              Re: how to automatically display from a list box?

              I noticed that Message-ID:
              <1113726305.029 183.54170@z14g2 000cwz.googlegr oups.com> from
              cricketunes@yah oo.com contained the following:
              [color=blue]
              >Can i Interject my PHP code with javascript blocks?[/color]

              You send Javascript just like you'd send HTML. Both are dealt with by
              the browser.

              But I'll repeat. You /must/ have an alternative method and I can see
              that you may be heading for a solution which relies on Javascript. You
              can't rely on Javascript being available.



              --
              Geoff Berrow (put thecat out to email)
              It's only Usenet, no one dies.
              My opinions, not the committee's, mine.
              Simple RFDs http://www.ckdog.co.uk/rfdmaker/

              Comment

              • jerry gitomer

                #8
                Re: how to automatically display from a list box?

                cricketunes@yah oo.com wrote:[color=blue]
                > Hi Folks,
                > I am working on a PHP/HTML form which supports End User queries.
                >
                > I need the user to select a combination of Airline and corresponding
                > place of Origin. i,e
                > Delta - Madison, Dallas, Atlanta
                > KLM - Amsterdam, Houston, Detroit
                > Brit - New York, London, Seattle
                >
                > I have a list of Airlines in a list box. The moment the user selects an
                > Airline(Delta) from the List box, the list box below it needs to have
                > (Dallas, Atlanta, Madison) as its options.
                >
                > How is this done? How do I use a listbox selection as a trigger an
                > automatically start the next activity?
                >[/color]
                [color=blue]
                > Thanks
                > Newbie to webdesign.
                >[/color]

                You can either use a drop down along with a submit button or
                build a one column (or more) HTML table and by using an HREF and
                making a table column "live" you can capture the airline
                information when your user clicks on an airline name. You can
                then use PHP to determine which airline was selected and present
                the user with a table containing that airline's schedule
                information.

                In the example below the list of properties is read from the
                database and each value displayed in a single column HTML table.
                When the user makes a select the php program doaup.php is
                invoked and the property name passed to it. (Note that this
                code will not run as is since I have cut out segments not
                related to illustrating my point.)


                $sql1 = "SELECT propname FROM gOProps
                WHERE accesscode = '$ac'
                ORDER BY propname";

                $result1 = $db->query($sql1) ;

                echo "</table> <br><tr><th><p> Name</p></th></tr>");


                while ($row = $result1->fetchRow()) {
                $propname = $row[0];
                echo ("<tr><td> <a href='doaup.php ?row_ID=$propna me'>
                $propname</a></td></tr>");
                }
                echo "</table>
                <br>
                ";

                Comment

                • cricketunes@yahoo.com

                  #9
                  Re: how to automatically display from a list box?

                  Thanks everyone. I am now using javascript functions for listbox
                  selection. however a couple of issues:

                  My objective is to send the Form Variables within a PHP Script to the
                  action-PHP file. So in this case:
                  Wouldn't my requirement be embedding javascript within PHP and not the
                  other way round?
                  Or is it to have PHP within javascript? Will the Action-PHP file still
                  receive Form data when PHP is within javascript?

                  Thanks.

                  Comment

                  • Geoff Berrow

                    #10
                    Re: how to automatically display from a list box?

                    I noticed that Message-ID:
                    <1114043254.511 338.179710@o13g 2000cwo.googleg roups.com> from
                    cricketunes@yah oo.com contained the following:
                    [color=blue]
                    >My objective is to send the Form Variables within a PHP Script to the
                    >action-PHP file. So in this case:
                    >Wouldn't my requirement be embedding javascript within PHP and not the
                    >other way round?
                    >Or is it to have PHP within javascript? Will the Action-PHP file still
                    >receive Form data when PHP is within javascript?[/color]

                    PHP runs on the server. Javascript runs on the client. Please try to
                    get your head around this. There is no interaction. PHP can output
                    Javascript, but as far as PHP is concerned it is just text.

                    --
                    Geoff Berrow (put thecat out to email)
                    It's only Usenet, no one dies.
                    My opinions, not the committee's, mine.
                    Simple RFDs http://www.ckdog.co.uk/rfdmaker/

                    Comment

                    Working...