?
Solved

GETting or POSTing a form

Posted on 2003-11-24
3
Medium Priority
?
212 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
[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
3 Comments
 
LVL 6

Expert Comment

by:andreif
ID: 9814706
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 150 total points
ID: 9814707
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
ID: 9828604
PHP up to version 4.3.0 the arrays name was $HTTP_SERVER_VARS ... the rest is the same.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.
Suggested Courses

777 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