/    Sign up×
Community /Pin to ProfileBookmark

getting the value of more forms in a page by a submit button in a form

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

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@littlenedSep 01.2006 — 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.
×

Success!

Help @mayanksrmcem 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 6.17,
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: @nearjob,
tipped: article
amount: 1000 SATS,

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

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...