Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Get and Post dilemna 1

Status
Not open for further replies.

mmaz

Programmer
Nov 22, 2000
347
Hi,

We have a directory of companies and we want to make it searchable and sortable. At the top of the page, there's A B C ...Z, and when the user clicks on one of the letters, I want to get the companies whose name starts with the submitted letter.

The problem is, there are also other controls on my search form, and they're submitted through the POST method, while the letters are in <a href>, passed with the GET method.

Does anybody have suggestions as to how I could achieve searching results with form controls AND alphabetical search, but without using client-side javascript?

HTML or server-side solution, anyone??

Thanks,

Marie
 
That should cause no problem... On your asp page do something like this...


<%
dim letter
letter = request(&quot;letter&quot;)

if request.servervariables(&quot;http_method&quot;) = &quot;POST&quot; then
'handle the posted form here...
end if
%>


You could also have the onClick for the letter put the letters value into a hidden form field and then submit the form (so all data is sent via &quot;post&quot;) Get the Best Answers! faq333-2924
Is this an asp FAQ? faq333-3048
Tek-Tips Best Practices: FAQ183-3179
It's sad that some Americans proudly turn their backs on the very Flag the gives them the opportunity to do just that... - Mike
 
Thanks for your reply. I actually wanted to use Get and Post at the same time, but I know that's not possible. I didn't want to use javascript, but it looks like I'll have to.

Marie
 
You can use both at the same time - post your form and add a querystring to your hyperlink. But you can only do one of the two at a time, unless you use javascript...

Let me know if I can help with the javascript... Get the Best Answers! faq333-2924
Is this an asp FAQ? faq333-3048
Tek-Tips Best Practices: FAQ183-3179
It's sad that some Americans proudly turn their backs on the very Flag the gives them the opportunity to do just that... - Mike
 
So what you're saying is that I can post AND get at the same time, and get the data from my form and get the url parameters on ONE submit or one click of the link...all that without using javascript?
 
NO you can't do both at once without javascript - one or the other only.

Add javascript and you can do both... Get the Best Answers! faq333-2924
Is this an asp FAQ? faq333-3048
Tek-Tips Best Practices: FAQ183-3179
It's sad that some Americans proudly turn their backs on the very Flag the gives them the opportunity to do just that... - Mike
 
That's what I thought. Thanks for confirming.
 
Well, it's not pretty BUT...

Instead of a row of text links with GET parameters hard-coded, how about a row of little submit buttons for your search form like this:

Code:
<input type=&quot;submit&quot; name=&quot;letter&quot; value=&quot;A&quot;>
<input type=&quot;submit&quot; name=&quot;letter&quot; value=&quot;B&quot;>
...

Your script could then determine which button POSTed the form by just looking at the value of
Code:
letter
. -- Chris Hunt
Extra Connections Ltd
 
Thanks everybody for your answers. I've decided to use Javascript because I think it's the best way. My problem was, I was trying to access POST and GET variables at the same time, i.e on one button-click, or one click of <a href> which as far as I know, cannot be done. I know that you can access POST and GET variables on the same page, of course, but at the same time? I don't think so...

Thanks again,

Marie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top