WSN Links
Featuresspacer Showcasespacer Reviewsspacer Demosspacer Purchasespacer Manualspacer Support

Register | Forgot Password
Searching by State
Searching by State
By Paul

Here's a common scenario: you want to allow your visitors to search for listings within the states of their choice. Here's an example search form you can use:

<form action="search.php?action=filter&amp;filled=1&amp;whichtype=links" method="post">
<p>Choose the states you want to search in:</p>

<table>
<tr>
<td valign="top">
<input type="hidden" name="statecondition" value="or" />
<input type="checkbox" name="statesearch[]" value="select all" onclick="checkuncheckstates()" /> All States<br />
{STATECHECKBOXES[statedirectoriessearch]}
</td>
</tr>
</table>

<br />Search for listings where the name contains
<input type="hidden" name="titlecondition" value="like" />
<input type="text" size="{STANDARDSIZE}" name="titlesearch" />
<br /><br />
<br /><input type="submit" value="Run Search" class="button" />

</form>


In the javascript header, insert this function:
function checkuncheckstates()
{
var boxes = document.getElementsByName('statedirectoriessearch[]');
for (i=1; i < boxes.length; i++)
{
if (boxes[i].checked == true) boxes[i].checked = false;
else boxes[i].checked = true;
}
}


This will display all the states (or provinces, depending on default country), 10 per column, with checkboxes and select all option. To change the number per column, or the separator between each state, change {STATECHECKBOXES[statesearch]} to {STATECHECKBOXES[statesearch <,> your separator <,> 10]}.

Rating:


0/5 based on 0 votes. The median rating is 0.

Submitted: 10/10/08

Description: Allowing visitors to search listings in their preferred states.

Views: 72 views. Averaging 1 per day.
In the most recent 30 day period, there've been 0 views.

Next Article

Home    |    Features    |    Showcase    |    Reviews    |    Demos    |    Purchase    |    Manual    |    Support