HI Guys
I have a simple check box form (using GET as the method) with a list of 10 different UK counties. I have validated the form so that users have to select no more and no less than 5 UK counties.
The validation works fine. However, when the form is posted to my next page (myresults.asp), I need the values of the options to output the following in my url, no matter what UK counties they choose or what order they select them in:
I WANT:
"www.mysite.com/myresults.asp?county1=London&county2=Oxford&county 3=Leeds&county4=Manchester&county5=Liverpool"
INSTEAD OF
"www.mysite.com/myresults.asp?checkbox=London&checkbox=Oxford&chec kbox=Leeds&checkbox=Manchester&checkbox=Liverpool"
You can view my full script below. If you have any ideas then that would be great.
I look forward to hearing from you
Rod from the UK
--------------SCRIPT--------------
<script Language="JavaScript">
<!--
function checkbox_checker()
{
var checkbox_choices = 0;
for (counter = 0; counter < checkbox_form.checkbox.length; counter++)
{
if (checkbox_form.checkbox[counter].checked)
{ checkbox_choices = checkbox_choices + 1; }
}
if (checkbox_choices > 5 )
{
msg="You're limited to only three selections.\n"
msg=msg + "You have made " + checkbox_choices + " selections.\n"
msg=msg + "Please remove " + (checkbox_choices-5) + " selection(s)."
alert(msg)
return (false);
}
if (checkbox_choices < 5 )
{
alert("Please select 5 counties. \n" + checkbox_choices + " entered so far.")
return (false);
}
alert(" *** Thank you for your selection. ***");
return (true);
}
-->
</script>
<form method="get" action="http://www.mysite.com/myresults.asp" onsubmit="return checkbox_checker()" name="checkbox_form">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td width="20%" valign="top">
<input type="checkbox" value="Oxford" name="checkbox">Anglesey<br>
<input type="checkbox" value="Liverpool" name="checkbox">Avon<br>
<input type="checkbox" value="Bedfordshire" name="checkbox">Bedfordshire<br>
<input type="checkbox" value="Berkshire" name="checkbox">Berkshire<br>
<input type="checkbox" value="London" name="checkbox">Borders<br>
<input type="checkbox" value="Buckinghamshire" name="checkbox">Buckinghamshire<br>
<input type="checkbox" value="Cambridgeshire" name="checkbox">Cambridgeshire<br>
<input type="checkbox" value="Manchester" name="checkbox">Central<br>
<input type="checkbox" value="Cheshire" name="checkbox">Cheshire<br>
<input type="checkbox" value="Cleveland" name="checkbox">Cleveland<br>
<input type="checkbox" value="Leeds" name="checkbox">Clwyd<br>
</td>
</tr>
</table>
<p align="center">
<input type="submit" value="Compare Counties">
</form>
----------SCRIPT END-----------