Blank form submit displays all listings
2 posts by 2 authors in: Forums > CMS Builder
Last Post: August 16, 2010 (RSS)
By (Deleted User) - August 16, 2010
Hi,
This is my form:
If a site visitors clicks on the submit button, without entering any text in the text field of the form, all listings are displayed. It also hapens on our other forms like "Search by City":
Is there away to only display listings if the visitors enters some text inthe form field?
This is my form:
<form method="POST" action="http://www.koshertravelinfo.com/minyan/minyan_listing.php">
<input type="text" name="minyan_name_keyword" value="">
<input type="submit" name="submit" value="Search Minyan">
</form>
If a site visitors clicks on the submit button, without entering any text in the text field of the form, all listings are displayed. It also hapens on our other forms like "Search by City":
<form method="POST" action="http://www.koshertravelinfo.com/minyan/minyan_listing.php">
<input type="text" name="city_keyword" value="">
<input type="submit" name="submit" value="Search Minyan">
</form>
Is there away to only display listings if the visitors enters some text inthe form field?
Re: [RapidWeb] Blank form submit displays all listings
By Jason - August 16, 2010
Hi,
What you can do is see if anything was entered into the text box before you output any data with your foreach loop.
It would look something like this:
This way the foreach loop will only run if a value was entered into the text box.
Hope this helps.
What you can do is see if anything was entered into the text box before you output any data with your foreach loop.
It would look something like this:
<?php if(@$_REQUEST['minyan_name_keyword']): ?>
<?php foreach(......) : ?>
*YOUR OUTPUT
<?php endforeach ?>
<?php endif ?>
This way the foreach loop will only run if a value was entered into the text box.
Hope this helps.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/