filling out textfields using a pulldown to select an mysql databaserecord

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • R.G. Vervoort

    filling out textfields using a pulldown to select an mysql databaserecord

    I would like to select an option in a pulldown, select a record in a mysql
    database depending on the pulldown selection and then put the data from the
    record in the textfields.

    I can retrieve the pulldown value using javascript

    I can open the database and select the record using php

    how can i combine the 2 to within the onchange option of the pull down.

    Any suggestions welcome because i am getting crazy with this


    roy






  • Markus Ernst

    #2
    Re: filling out textfields using a pulldown to select an mysql databaserecord

    "R.G. Vervoort" <roy.vervoort@r oyvervoort.nl> schrieb im Newsbeitrag
    news:407e3d3d$0 $566$e4fe514c@n ews.xs4all.nl.. .[color=blue]
    > I would like to select an option in a pulldown, select a record in a mysql
    > database depending on the pulldown selection and then put the data from[/color]
    the[color=blue]
    > record in the textfields.
    >
    > I can retrieve the pulldown value using javascript
    >
    > I can open the database and select the record using php
    >
    > how can i combine the 2 to within the onchange option of the pull down.
    >
    > Any suggestions welcome because i am getting crazy with this[/color]

    As Javascript runs on the client and PHP/MySQL on the server you have the
    following 2 possibilities:

    1. After having choosen the pulldown value you submit the form and display
    the page again with the value filled into the textfield by PHP.

    2. If you don't want to submit the form you have to bring the database
    entries to the client side: write the records from MySQL into a Javascript
    array with PHP and then get them from there with Javascript.

    HTH
    Markus


    Comment

    • Pierced Media LC

      #3
      Re: filling out textfields using a pulldown to select an mysql databaserecord

      If I understand properly, you want to use a <select></select> element to
      select some given information from a database, but you want to do this
      without reloading the page. The short answer is "it can't be done" Once the
      page is loaded, it's all there, another HTTP request must be made to run
      more processes. If you don't want to reload an entire page you could use an
      Iframe/layer.

      Hope this helped.

      --
      Jeremy Jacobs

      "Greater men require and desire greater Goals, greater Standards, and
      greater Accountability"


      "R.G. Vervoort" <roy.vervoort@r oyvervoort.nl> wrote in message
      news:407e3d3d$0 $566$e4fe514c@n ews.xs4all.nl.. .[color=blue]
      > I would like to select an option in a pulldown, select a record in a mysql
      > database depending on the pulldown selection and then put the data from[/color]
      the[color=blue]
      > record in the textfields.
      >
      > I can retrieve the pulldown value using javascript
      >
      > I can open the database and select the record using php
      >
      > how can i combine the 2 to within the onchange option of the pull down.
      >
      > Any suggestions welcome because i am getting crazy with this
      >
      >
      > roy
      >
      >
      >
      >
      >
      >[/color]


      Comment

      • Thomas 'PointedEars' Lahn

        #4
        Re: filling out textfields using a pulldown to select an mysql databaserecord

        R.G. Vervoort wrote:
        [color=blue]
        > I would like to select an option in a pulldown, select a record in a mysql
        > database depending on the pulldown selection and then put the data from the
        > record in the textfields.
        >
        > I can retrieve the pulldown value using javascript
        >
        > I can open the database and select the record using php
        >
        > how can i combine the 2 to within the onchange option of the pull down.[/color]

        You cannot, unless you want to serve the database data along with the
        document that contains the "select" element or (re)load the/a new document,
        as Markus pointed out. Retrieval of server-side information requires a
        (HTTP) request. If you know your target environment, you may want to use
        XMLHTTPRequest. Ask Google (Groups).

        Excessive crossposting like this without Followup-To is unwished in Usenet.
        Especially comp.lang.java. javascript is IMO obsolete, Java != JavaScript.
        Please learn how to post: <http://www.faqs.org/faqs/usenet/posting-rules/part1/>


        F'up2 comp.lang.javas cript

        PointedEars

        Comment

        Working...