Solved

GETting or POSTing a form

Posted on 2003-11-24
3
205 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
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 50 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
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.

785 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