Click to See Complete Forum and Search --> : getting the value of more forms in a page by a submit button in a form


mayanksrmcem
09-01-2006, 02:02 AM
hello friends,
i've a problem in handling two comboboxes in a php page.
in one conbobox the name of countries is fill from database.
and in the other combobox,data is filled from database related to the select country on onchage event of first combo box
the first combo box is in first frame and other in sesond.
the submit button is in second form.

my problem is how can i get the value of aal controls present in the web page.

my code for this is as follows-----


<body bgcolor="#FFFFFF" text="#000000">
<form name="form1" method="GET" action="<? echo $_SERVER['PHP_SELF']; ?>">
<table>
<tr>
<td>
<select name="cb1" onchange="submit();">
<option>SELECT</option>
<?php
while($data=mysql_fetch_array($result))
{
?>
<option <? if(isset($_REQUEST['cb1']) && $con == $data["coun_name"]) { ?> selected <? } ?>><? echo $data["coun_name"]; ?></option>
<?php
}
?>
</select>
</td>
</tr>
<tr>
<td>
<select name="cb2">
<option>SELECT</option>
<?php
if(isset($_REQUEST['cb1']))
{
while($data1=mysql_fetch_array($r1))
{
?>
<option><? echo $data1["city_name"]; ?></option>
<?php
}
}
?>
</select>
</td>
</tr>

</table>

</form>
<form name="form2" method="get" action="<? echo $_SERVER['PHP_SELF']; ?>">
<input type="text">
<input type="text">
<input type="text">
<input type="text">
<input type="submit">
</form>
</body>


waiting for your reply......
mayanksrmcem

littlened
09-01-2006, 07:08 AM
I'm not sure if this is the right way to do it, but you could probably put all the fields on one page and use a javascript onchange event on the country drop down, when the drop down changes it refreshes the page sending the value of the field so that it can be used to populate the second drop down.

using frames is not the answer.

a quick search on google produced this http://www.trans4mind.com/personal_development/JavaScript/tripleMenu.htm
it might not completely solve your problem but should give you an idea.