By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,639 Members | 3,129 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,639 IT Pros & Developers. It's quick & easy.

filling out textfields using a pulldown to select an mysql databaserecord

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
"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

P: n/a
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

P: n/a
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.