HighDots Forums  

Search Form Parameters

Macromedia Dreamweaver Macromedia Dreamweaver Discussions (macromedia.dreamweaver)


Discuss Search Form Parameters in the Macromedia Dreamweaver forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Joe Buck
 
Posts: n/a

Default Search Form Parameters - 11-10-2005 , 09:17 AM






Hello,

I have a search form that has two checkboxes in it. The search form uses the
GET method to another page that returns the results from a MySQL DB. So, heres
the problem: When I check one checkbox, it returns the correct results, but if
I check both checkboxes, it only displays the first checkbox value. Below is my
code from the search page form and the recordset varibles for my results page.

Search Page

<tr>
<td colspan="4"><form action="master.jsp" method="get" name="form1" id="form1">
<label> </label>
<table width="71%" border="0" align="center" cellpadding="2" cellspacing="2">
<tr>
<td colspan="2" class="table"><div
align="center"><strong>Locations</strong></div></td>
</tr>
<tr>
<td width="50%">&nbsp;</td>
<td width="50%">&nbsp;</td>
</tr>
<tr>
<td><label>
<input name="Location" type="checkbox" id="Shadyside" value="Shadyside" />
Shadyside</label>
<label></label></td>
<td>&nbsp;</td>
</tr>
<tr>
<td><input name="Location" type="checkbox" id="Squirrel Hill" value="Squirrel
Hill" />
<label for="checkbox"> Squirrel Hill</label></td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table>
<p>&nbsp;</p>
<p>
<label>
<div align="center">
<div align="center">
<input name="Submit" type="submit" id="Submit" value="Search Properties" />
<label for="label"><br />
<br />
</label>
<input type="reset" name="Submit2" value="Clear Search" id="label" />
</div>
</label>
</form>

Results Page

SELECT *
FROM item.complex_table
WHERE Neighborhood like 'varLocation'

Recordset

Name, Default Value, Run Time Value
varLocation, %, request.getParameter("Location")


Thanks so much,
Joe


Reply With Quote
  #2  
Old   
Gary White
 
Posts: n/a

Default Re: Search Form Parameters - 11-10-2005 , 11:51 AM






On Thu, 10 Nov 2005 14:17:06 +0000 (UTC), "Joe Buck"
<webforumsuser (AT) macromedia (DOT) com> wrote:

Quote:
input name="Location" type="checkbox" id="Shadyside" value="Shadyside" /
input name="Location" type="checkbox" id="Squirrel Hill" value="Squirrel

Your two checkboxes both have the same name, so only one value will be
passed. You can either name them differently, or you can name them so
PHP will treat them as an array by changing the name to "Location[]".
However, it would require a change to your code that processes the form
to implement the array approach.

Gary


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.