/    Sign up×
Community /Pin to ProfileBookmark

Java, Forms and MySql

Hello all!

Well, i hope you can give some advice on how to work with Java in a form.

I’m working with MySql and PHP and i want to do the following:

I have two ‘select’ boxes in a form. Choosing a value in the first select box, it should show me the corresponding value in the second box.

Example:

Choosing the ‘process number’ in the first select box, it should retrieve the corresponding ‘process description’ in the second select box.

More, the values from the ‘select boxes’ comes from a MySql table. When the data is saved, the values of the first and second ‘select boxes’ should be recorded on a diferent table.

I have few knowledge on PHP and zero on Java, but someone told me that it could be done with java.

Can you put me in the right way?
Thank you a lot ?

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@Mr_Initial_ManApr 08.2008 — You'd get better results if you put this in the Java forum. Java and JavaScript are entirely different languages.
Copy linkTweet thisAlerts:
@kurbyApr 08.2008 — Heres a basic outline of what you need to know.

1) onclick for options: check to make sure its selected, pass the value to a PHP script using XMLHttpRequest.

2)PHP page queries the database with the value passed, stores results in an array.

3)Itterate through array and print all the options in <option> tags.

4)Back in the javascript, grab the response as xml = XMLHttpRequest.responseXML.

5)Grab all the options by options = xml.getElementsByTagName("option");

6)Iterate through options array and append to form with form.appendChild(options[x]);

Its a lengthy process so I didn't want to have to write out all the details. I hope this is helpful. You may need to do some research into how you work with AJAX(XMLHttpRequest).
×

Success!

Help @tubarao21 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.28,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...