[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 174
  • Last Modified:

Recreating FORM "POST" without FORMS

I have created a search engine.  The user enters in data in the preceding form (list box and input box) and this data is passed to SEARCH2.CGI.  The engine runs through the dbase and pulls out the matches and returns it to the user.

Now the returned matches can be HUGE (400+) and so I display  a maximum of 20 matches.  A "NEXT" hyperlink text will appear for the user to click to the next page (much like YAHOO).  Now when the user clicks the NEXT text it recalls the search engine with the user data again and it will continue from where it left off and so pass back the next 20 matches.  How I achieved this is I place a LONG query string after the earch2.cgi name: (http://mysite/search2.cgi?N1=100&N2=3000&N4=1&E=100...)
The data after the "?" can be quite long.  I heard/read that the QUERY STRING size is finite (quite small) and so my enormous NEXT hyperlink probably won't work.  Is this true? What is the limit for QUERY STRING or is it server dependent?

The only thing I heard that can solve this problem is using the POST method as most of us do when we send out forms.  Problem I'm having though is how to get my NEXT hyperlink text to send its required data via the POST method withou "having" to use any form objects?

Any solutions you brainyacks?
0
mirror
Asked:
mirror
  • 2
  • 2
1 Solution
 
julio011597Commented:
I guess you cannot but use a form and a bunch of hidden types to send via POST.

I'm curious as well about env vars limits: i've a couple of CGI books which don't mention anything about it, while they worry about using lots of words with an ISINDEX query.
0
 
alamoCommented:
You really shouldn't need to post the same question in both CGI and HTML, the areas are closely enough related that most experts who check one also check the other.

But since I posted a long comment over there, I might as well post it here as an answer...

Problem with using a form is you can't have a simple "Next page" link, you need a button. But still probably the easiest approach.

The safest limit is 1024 characters for the entire URL (inluding 'escaping' any non-alphanumeric characters). If your server supports 2048 characters, that's pretty safe too. Some but not all clients can handle more, so you are definitely asking for trouble over 2048 characters.

Another way to do this is to save server-side the query (in a time-stamped file), and simply refer to that in your "next" link. You need a cleanup process, though, and the page therefore isn't really bookmarkable.

Yet another approach is to use javascript to remember the search parameters page-to-page, this will work without server-side intervention as long as you know your users will have JS.

Hope this helps, good luck!
0
 
PozzoCommented:
well ...

the easiest way is to use a form with
<form method=post action=search2.cgi>
<input type=hidden name=N1 value=V1>
...

<input type=image src="next.gif" name="next">
</form>

as you can see on the Altavista search engine ...
using the post method of the form, data are transmitted via
the stdin/out and you are not limited to 1 ko like with Query_string (an environment variable)


0
 
alamoCommented:
Well, Pozzo, actually I said that - 'But still probably the easiest approach.' You are right though, an image can be used in place of the button.

I am puzzled by your reference to AltaVista though- I use AV all the time and all I've ever seen there is normal links using GET, e.g. http://altavista.digital.com/cgi-bin/query?pg=aq&text=yes&q=whatever&stq=10
0
 
julio011597Commented:
IMO, there are a couple of reasons which make GET the best method for search engines:

first, GET makes bookmarked pages keep working;
second, you avoid the annoying "Repost form data?" dialog.
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now