Solved

Recreating FORM "POST" without FORMS

Posted on 1997-12-03
5
168 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 50 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

What Is Transaction Monitoring and who needs it?

Synthetic Transaction Monitoring that you need for the day to day, which ensures your business website keeps running optimally, and that there is no downtime to impact your customer experience.

Question has a verified solution.

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

In this tutorial I will focus on how to use WhizBase as a tool for sending ICQ messages to ICQ. Here I will use a new technology in WhizBase, published in WhizBase 5.1 version. In this tutorial I will use 3 files, pager.wbsp for the processing, e…
The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
The viewer will learn how to dynamically set the form action using jQuery.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

695 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