hi ,

i have a php page with java script embed in it , i have 3 forms in a single page ... namely form1, form2, form3 .
form 1 and form2 have a text box , these text boxes get input from users. Now my task is to get the value of these 2 tex boxes in form3 when the user click the submit button , so that i pass the values in those text boxes to next page for calculation.

i tried the following code in form3 but it result in vain :

<script type='text/javascript' language='JavaScript'>
var resp_1= document.q1.response1.value;
document.counter.response1_user.value= resp_1;
</script>

q1 = name of form1 , response1 = text box in form1
counter = name of form3 , response1_user = text box in form3.

any help is appreciated ...

Thank you !

u dont really need to make a variable resp_1 here. No harm if u made it.

put that code in a method say func1() and call it on the click of the submit of form1 or on click of a button. As u like.

@goldy

Hi, is there any reason you need to have the 2 values from form1 and form2 calculate into the text box in form3 before you go to the next page?

If not, then put the text box from form1 and form2 in a single form. Then when you submit the form to the next page do the calculations with the two values on that page.

Page 1

<form name='form1' method='post' action='nextpage.php'>
<input type='text' name='value1'>
<input type='text' name='value2'>
<input type='submit' value='Submit'>
</form>
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.