i want to make a form which is shows in following image.(screenshot)

in which first field comes from database.echo values.

in second fields same value come from database.

now in third text field i want to show these values example

e.g

value of first fields>>>> jaisingh

value of second field>>>jairam

so after selecting both value a third value will show as

third field>>>jaisingh--jairam-1

Hi there,
What you need is a little javascript to make this work, the following is an example:

var value1 = document.getElementById('list1').options[document.getElementById('list1').options.selectedIndex].value;
var value2 = document.getElementById('list2').options[document.getElementById('list2').options.selectedIndex].value;
var value3 = value1 + '--' + value2 + '-';
document.getElementById('text_box).value = value3;

Just put this code between some script tags at the top of your page, correct the element ID's to match your html and call the function from your second "select" element's onchange attribute.

sorry ,
i could not define my actual proble. i m going to tell again.
i have a table.have field:c_id, cityname.citycode
data in this table A:1st row: (1,jaipur,jp), second row: (2,ajmer,aj)
i have a another table have field:route_id,route_code
data in thistable B:1st row: (1,jp-aj-1)

now we come the exact problem
i am getting value of from table A in my first textfields;

same thing i am getting in my second textfields;

now i want value of these in third textfields;

example if i choose jaipur as code jp from first textfields, and aj from second fields, then it should be in third textfields as:

jp-aj-1, but we are watching that it is already exist in table B, then what will we do, it is auto matically get jp-aj-2

thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.