472,805 Members | 1,117 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,805 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 2480
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: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.