473,396 Members | 1,772 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Need Some Help With Query Processing

Hi.

I need some help with structuring my query strings.

I have a form with a search bar and some links. Each
link is a search type (such as "community"). The HREF
for the link's anchor looks like the following:

<a href="?searchtype=2">Community</a>

When the user clicks on the Community search type, the query string
looks like:

http://www.domain.com/test.htm?searchtype=2

Then, he puts in his search string, such as "babysitters
in los angeles".

I want the string to look like the below before the form
is posted:

http://www.domain.com/test.htm?searc...in+los+angeles

But it looks like:

http://www.domain.com/test.htm?query...in+los+angeles

How do i get the querystring to "add" the query to the searchtype and
not "replace" the searchtype with the query?

I thank you.

Aug 29 '07 #1
3 2536
On Aug 29, 10:38 pm, pbd22 <dush...@gmail.comwrote:
Hi.

I need some help with structuring my query strings.

I have a form with a search bar and some links. Each
link is a search type (such as "community"). The HREF
for the link's anchor looks like the following:

<a href="?searchtype=2">Community</a>

When the user clicks on the Community search type, the query string
looks like:

http://www.domain.com/test.htm?searchtype=2

Then, he puts in his search string, such as "babysitters
in los angeles".

I want the string to look like the below before the form
is posted:

http://www.domain.com/test.htm?searc...itters+in+los+...

But it looks like:

http://www.domain.com/test.htm?query...in+los+angeles

How do i get the querystring to "add" the query to the searchtype and
not "replace" the searchtype with the query?

I thank you.
You can't do it like this. You need to get the existing query, add a
new string and pass it to the new url.

For example,

string new_url =
"http://www.domain.com/test.htm?searchtype="
+ Request.QueryString["searchtype"]
+ "&"
+ "query=" + Request.QueryString["query"];

Aug 29 '07 #2
On Aug 29, 3:33 pm, Alexey Smirnov <alexey.smir...@gmail.comwrote:
On Aug 29, 10:38 pm, pbd22 <dush...@gmail.comwrote:
Hi.
I need some help with structuring my query strings.
I have a form with a search bar and some links. Each
link is a search type (such as "community"). The HREF
for the link's anchor looks like the following:
<a href="?searchtype=2">Community</a>
When the user clicks on the Community search type, the query string
looks like:
http://www.domain.com/test.htm?searchtype=2
Then, he puts in his search string, such as "babysitters
in los angeles".
I want the string to look like the below before the form
is posted:
http://www.domain.com/test.htm?searc...itters+in+los+...
But it looks like:
http://www.domain.com/test.htm?query...in+los+angeles
How do i get the querystring to "add" the query to the searchtype and
not "replace" the searchtype with the query?
I thank you.

You can't do it like this. You need to get the existing query, add a
new string and pass it to the new url.

For example,

string new_url =
"http://www.domain.com/test.htm?searchtype="
+ Request.QueryString["searchtype"]
+ "&"
+ "query=" + Request.QueryString["query"];
OK, thanks. I guess I am still a little confused.

Doesn't your response imply that the querystring is already well
formed?
I would need searchtype and query in he querystring to be able to call
Request.QueryString["searchtype"] or Request.QueryString["query"] .
If you mean to pull this information from the querystring prior to
submitting
the form, I still don't understand how the querystring gets formed. It
does,
however, make more sense to simply take local variables where
searchtype and query are stored and construct the querystring from
that - if that is OK.

I am assuming that the new_url string you have is what would be
created
when the form is submit? Would you mind showing me how, exactly, the
new string would get passed to the next page? Filling out the script
would be helpful to me. below is my form with my query input box:

<form id="searchWidget">
<span>&nbsp;</span>
<input class="query" size="40"
name="query" type="text">
<input class="submit" value="Search"
type="submit">
<a class="adv" href="/
index.master_search.aspx?a=a&amp;x=1">Advanced Search</a>
<span>&nbsp;</span>
</form>

Thanks and apologies for my continued confusion here.

Aug 31 '07 #3
On Aug 31, 5:05 pm, pbd22 <dush...@gmail.comwrote:
On Aug 29, 3:33 pm, Alexey Smirnov <alexey.smir...@gmail.comwrote:


On Aug 29, 10:38 pm, pbd22 <dush...@gmail.comwrote:
Hi.
I need some help with structuring my query strings.
I have a form with a search bar and some links. Each
link is a search type (such as "community"). The HREF
for the link's anchor looks like the following:
<a href="?searchtype=2">Community</a>
When the user clicks on the Community search type, the query string
looks like:
>http://www.domain.com/test.htm?searchtype=2
Then, he puts in his search string, such as "babysitters
in los angeles".
I want the string to look like the below before the form
is posted:
>http://www.domain.com/test.htm?searc...itters+in+los+...
But it looks like:
>http://www.domain.com/test.htm?query...in+los+angeles
How do i get the querystring to "add" the query to the searchtype and
not "replace" the searchtype with the query?
I thank you.
You can't do it like this. You need to get the existing query, add a
new string and pass it to the new url.
For example,
string new_url =
"http://www.domain.com/test.htm?searchtype="
+ Request.QueryString["searchtype"]
+ "&"
+ "query=" + Request.QueryString["query"];

OK, thanks. I guess I am still a little confused.

Doesn't your response imply that the querystring is already well
formed?
I would need searchtype and query in he querystring to be able to call
Request.QueryString["searchtype"] or Request.QueryString["query"] .
If you mean to pull this information from the querystring prior to
submitting
the form, I still don't understand how the querystring gets formed. It
does,
however, make more sense to simply take local variables where
searchtype and query are stored and construct the querystring from
that - if that is OK.

I am assuming that the new_url string you have is what would be
created
when the form is submit? Would you mind showing me how, exactly, the
new string would get passed to the next page? Filling out the script
would be helpful to me. below is my form with my query input box:

<form id="searchWidget">
<span>&nbsp;</span>
<input class="query" size="40"
name="query" type="text">
<input class="submit" value="Search"
type="submit">
<a class="adv" href="/
index.master_search.aspx?a=a&amp;x=1">Advanced Search</a>
<span>&nbsp;</span>
</form>

Thanks and apologies for my continued confusion here.- Hide quoted text -

- Show quoted text -
I thought you are talking about ASP.NET. The form you have here is not
a server form (runat="server") and you cannot use my example with
Request.QueryString. Either, you have to use a javascript to build url
and redirect to it, or you can use GET method for example

<form action="/index.master_search.aspx" method="GET">
<input class="query" size="40" name="query" type="text">
<input type="hidden" name="searchtype" value="2"
<input class="submit" value="Search" type="submit">
</form>

When you type "blabla" in the text field and submit the form you would
be redirected to

/index.master_search.aspx?query=blabla&searchtype=2

Aug 31 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: leegold2 | last post by:
Let's I do a mysql query and then I do a, for( $i = 1; $row = mysql_fetch_array($result); $i++ ) {...} and it gives me this: PageID Title URL Description 1 lee's ...
2
by: Dynamo | last post by:
Hi again folks, As a relative newbie I am probably trying to run before I can walk but here goes: Thanks to all you good folks I have managed to get some sort of a site up and running whereby...
8
by: Bill | last post by:
Hello out there; This may be a challenge but I'm certain it's possible but I can't seem to figure out how. I have a table that has several date fields, e.g., Date1, Date2, Date3, Date4 ......
3
by: ssb | last post by:
Hello, This may be very elementary, but, need help because I am new to access programming. (1) Say, I have a column EMPLOYEE_NAME. How do I fetch (maybe, cursor ?) the values one by one and...
6
by: James Radke | last post by:
Hello, I have a multithreaded windows NT service application (vb.net 2003) that I am working on (my first one), which reads a message queue and creates multiple threads to perform the processing...
10
by: varlagas | last post by:
I execute a query (against DB2 for iSeries), which, in its generic form is as follows. This query runs just fine, executing in a couple of seconds SELECT V.FIELD01, V.FIELD02, V.FIELD03,...
8
by: pamelafluente | last post by:
I am beginning aspNet, I know well win apps. Need a simple and schematic code example to start work. This is what I need to accomplish: ---------------------- Given button and a TextBox on a...
16
by: pamelafluente | last post by:
I am still working with no success on that client/server problem. I need your help. I will submit simplified versions of my problem so we can see clearly what is going on. My model: A client...
5
by: Justin | last post by:
Here's my XML: <?xml version="1.0" ?> <AppMode Type="Network"> <CurrentFolder Path="c:\tabs"> <Tabs> <FilePath>tabs\Justin.tab</FilePath> <FilePath>tabs\Julie.tab</FilePath> *****There could...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.