?
Solved

Recreating FORM "POST" without FORMS

Posted on 1997-12-03
5
Medium Priority
?
170 Views
Last Modified: 2013-12-25
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
Comment
Question by:mirror
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 5

Expert Comment

by:julio011597
ID: 1831491
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
 
LVL 6

Accepted Solution

by:
alamo earned 200 total points
ID: 1831492
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
 

Expert Comment

by:Pozzo
ID: 1831493
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
 
LVL 6

Expert Comment

by:alamo
ID: 1831494
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
 
LVL 5

Expert Comment

by:julio011597
ID: 1831495
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

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you get a (Blue Screen of Death), your system writes a small file called a minidump. Your first step is to make certain your computer is setup to record memory dumps. Right click My Computer, choose properties. Click on the advanced tab, an…
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question