PHP Muliple Forms GET method Help Needed

2 replies
<form name="district" action="">
<select name="SelectURL" onChange="location.href=district.SelectURL.options[selectedIndex].value">
<option value="">District</option>
<option value="state/district1>DISTRICT1</option>
<option value="state/districk2">DISTRICT2</option>
<!-- MULIPLE VALUES WOULD BE CALLED HERE FROM THE DATABASE &
ACCORDINGLY WILL FETCH THE BRANCH NAMES & DISPLAY IT ON "branch" FORM-->
</select></div>
</form>


<form name="branch" action=""><div>
<select name="SelectURL" onChange="location.href=branch.SelectURL.options[selectedIndex].value">
<option value="">Branch</option>
<option value="district1/branch1">BRANCH1</option>
<option value="district1/branch2">BRANCH2</option>
</select></div>
</form>
Basically i want to make the urls search engine friendly, I want the district name to come up in the url after the user chooses the district from the select menu(reason why i have set the above forms property to OnChange=href.blah).

But the problem I am facing is, once the user selects the district, its been redirected to lets say
localhost/state/district1/ which as an invalid page, i understand i should create a directory
on the server like state>district>index.php & then process the next form according to the values recieved,
but the problem is there are plenty of districs listed according to the state selected..
(yea its kinda complex)

I would like to process the forms back to back . Like if a user chooses a district,
the url should change, lets say a user selected 'district1' from the select options
The url should change from localhost/state/ to localhost/state/district1/ & then according
to the district it should goto next form, that is 'branch' form. I donno how to do that.. Somebody please help me..


Please somebody help me to sort this out.. have been playing around with it since 2days & din't successed.
I hope some warriors would me out.. Thanks
#forms #method #muliple #needed #php
  • Profile picture of the author SteveJohnson
    You're going to need to learn how to use mod_rewrite if you want to have data in the URLs. Basically, you'll strip part of the URL and send it back to the server as part of the query string. You'll use that data in your forms processing.
    Signature

    The 2nd Amendment, 1789 - The Original Homeland Security.

    Gun control means never having to say, "I missed you."

    {{ DiscussionBoard.errors[5033877].message }}
  • Profile picture of the author scriptkid
    thanks for the clue SteveJohnson
    I figured out the way
    {{ DiscussionBoard.errors[5042904].message }}

Trending Topics