Home > Archive > PHP Language > April 2004 > filling out textfields using a pulldown to select an mysql databaserecord
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
filling out textfields using a pulldown to select an mysql databaserecord
|
|
| R.G. Vervoort 2004-04-15, 4:31 am |
| 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 2004-04-15, 7:31 am |
| "R.G. Vervoort" <roy.vervoort@royvervoort.nl> schrieb im Newsbeitrag
news:407e3d3d$0$566$e4fe514c@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
| |
| Pierced Media LC 2004-04-25, 9:32 pm |
| 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" <roy.vervoort@royvervoort.nl> wrote in message
news:407e3d3d$0$566$e4fe514c@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
>
>
>
>
>
>
| |
| Thomas 'PointedEars' Lahn 2004-04-27, 12:23 am |
| 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
|
|
|
|
|