Solved

POST / GET ???  what's the difference

Posted on 1998-08-15
5
125 Views
Last Modified: 2013-12-25
Could someone tell me what's the difference between POST and GET with an example for each please?
0
Comment
Question by:fleal
  • 4
5 Comments
 
LVL 7

Accepted Solution

by:
jconde earned 200 total points
ID: 1827420
The difference between post and get is basically the way the parameters to the cgi are passed by.

while get reads the QUERY_STRING ambient variable, POST reads the standard input.

ej:

#include <stdio.h>

void main()
{
  char *cl;
  cl = getenv("QUERY_STRING");
  puts ("Content-Type:  text/html\n");
  printf ("%s",cl);
}

this example will print something like:
first=first+parameter&second=second+parameter.......
where first and second are the names of the controls you set in your form.

using post would be something like this:

#include <stdio.h>
void main()
{
char a[100];
printf ("Content-type: text/html\n\n");
fgets(a, 100, stdin);
printf ("%s",a);
}
this example will have the same output as the first.

with get, you can only send a few parameters to the cgi.  Thus makeing it unstable at some point.

with POST you override that problem.


--jconde
0
 
LVL 7

Expert Comment

by:jconde
ID: 1827421
Which one of those do you recommend for a simple search engine that will be using 6 parameters at the most?
0
 
LVL 7

Expert Comment

by:jconde
ID: 1827422
It doesnt matter! fleal, but try using post!
0
 

Author Comment

by:fleal
ID: 1827423
Jconde,

I not be using 6 parameters.  I will be coding a shopping cart and there will be more than 6 parameters.

fleal.
0
 
LVL 7

Expert Comment

by:jconde
ID: 1827424
Ok, then you should consider using COOKIES instead!
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

This tutorial will discuss the log-in process using WhizBase. In this article I assume you already know HTML. I will write the code using WhizBase Server Pages, so you need to know some basics in WBSP (you might look at some of my other articles abo…
Batch, VBS, and scripts in general are incredibly useful for repetitive tasks.  Some tasks can take a while to complete and it can be annoying to check back only to discover that your script finished 5 minutes ago.  Some scripts may complete nearly …
Learn the basics of if, else, and elif statements in Python 2.7. Use "if" statements to test a specified condition.: The structure of an if statement is as follows: (CODE) Use "else" statements to allow the execution of an alternative, if the …
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

910 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now