Solved

GETting or POSTing a form

Posted on 2003-11-24
3
203 Views
Last Modified: 2006-11-17
How do I determine whether I am GETting from a form (i.e. first time called) or being POSTed from a form(the user caused a submit)?
0
Comment
Question by:AntonBotes
3 Comments
 
LVL 6

Expert Comment

by:andreif
Comment Utility
there are 2 global arrays $_GET and $_POST

if you looking for some field name, let's say 'submit' you may check which of $_GET['submit'] or $_POST['submit'] is defined
0
 
LVL 14

Accepted Solution

by:
ThG earned 50 total points
Comment Utility
You mean from the client side or the server side?
from the server side it's trivial, just check the $_SERVER['REQUEST_METHOD'] variable..
it should be either GET or POST
0
 
LVL 1

Expert Comment

by:Snyke
Comment Utility
PHP up to version 4.3.0 the arrays name was $HTTP_SERVER_VARS ... the rest is the same.
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Both Easy and Powerful How easy is PHP? http://lmgtfy.com?q=how+easy+is+php (http://lmgtfy.com?q=how+easy+is+php)  Very easy.  It has been described as "a programming language even my grandmother can use." How powerful is PHP?  http://en.wikiped…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.

743 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

18 Experts available now in Live!

Get 1:1 Help Now