Current location: Hot Scripts Forums » Programming Languages » ASP » Weird ASP/SQL Problem


Weird ASP/SQL Problem

Reply
  #1 (permalink)  
Old 03-06-07, 12:23 AM
cancer10 cancer10 is offline
Wannabe Coder
 
Join Date: Oct 2006
Location: India
Posts: 154
Thanks: 0
Thanked 0 Times in 0 Posts
Question Weird ASP/SQL Problem

Weird ASP/SQL Problem


Consider the following HTML Form, it has a textbox and a search button.

Code:
<form method=post action="search.asp">
<input name="txtName" type="text" id="txtEmail" />
<input type="submit" name="Submit3" value="Search" />
</form>
The search.asp page:

Code:
select * from tbl_group_contact where userName ='"& request("txtName") &"'

if I put this query in the search.asp page then it will search by name based on the name I entered in the textbox. But if I leave the textbox empty and click on the search button, SQL fetches all the rows from the table. If you havent noticed this before, try it now!!


Well, this is not my problem/question. my question is if I place a combo box instead of the textbox and assign a NULL value to one of the option field like:

Code:
<select name="txtType" id="txtType">
<option value="" selected="selected">All</option>
</select>

and press the search button, then it does not fetch all the rows as it did for the empty textbox.

Any idea why?
Reply With Quote
  #2 (permalink)  
Old 03-06-07, 08:20 AM
koncept
Guest
 
Posts: n/a
i have never had this issue. I would just add some server side and client side checks for this
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
ASP/SQL - Problem cancer10 ASP 3 02-27-07 11:55 PM
Weird innerHTML problem nekeno12 JavaScript 2 03-29-06 01:28 PM
Weird mysql_query and Smarty problem Canglan PHP 3 11-15-05 08:49 PM
Weird Problem. domeger PHP 1 08-05-05 02:17 PM
Weird Problem Dazza203 PHP 7 01-01-04 03:08 AM


All times are GMT -5. The time now is 03:55 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.