471,319 Members | 1,876 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,319 software developers and data experts.

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


Jul 17 '05 #1
3 2482
"R.G. Vervoort" <ro**********@royvervoort.nl> schrieb im Newsbeitrag
news:40*********************@news.xs4all.nl...
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


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
Jul 17 '05 #2
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
www.PiercedMedia.com
"Greater men require and desire greater Goals, greater Standards, and
greater Accountability"
"R.G. Vervoort" <ro**********@royvervoort.nl> wrote in message
news:40*********************@news.xs4all.nl...
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


Jul 17 '05 #3
R.G. Vervoort wrote:
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.


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.javascript

PointedEars
Jul 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.