Click here to get back home

FF triggering $_POST array even on no submission?

 HomeNewsGroups | Search

get this group's latest topics as an RSS feed  comp.lang.php - PHP programming language discussions

please rate
this thread
If you were  Registered and logged in, you could reply and use other advanced thread options
Posted by lawpoop on March 3, 2009, 2:14 pm
I'm writing a page where I have a javascript function that validates
some form fields before a submission. I'm troubleshooting it, and I
think it's prematurely submitting the form.

I wrote a test at the beginning of my page to test whether $_POST is
an array, and in FireFox 3.0.6 it's always an array, even before any
submission. I've tried IE 6.8.2, and $_POST does not start out as an
array.

What's going on here? It looks to me like a problem with FireFox -- it
must be sending something to the server to indicate that there are
some POST values, even if there are none. I say it's in FF, because if
it were a problem with the web server, then IE should be triggering
POST also.

I can make a more robust $_POST test by using count() or checking for
certain values, but I am just wondering what's going on here.

Posted by Jerry Stuckle on March 3, 2009, 2:39 pm


lawpoop wrote:


??? How can your page get control unless something was submitted?
What's in the array?



Maybe you have a misunderstanding.  PHP runs on the server, and all PHP
code is executed before the page is delivered to the client.  Javascript
is run on the client, and executes after the page has been delivered.
They don't interact directly.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Posted by lawpoop on March 3, 2009, 4:42 pm
Here's another way of asking my question -- does the $_POST array
always exist, no matter how the page was requested? So if the page
wasn't generated from a POST request, the variable $_POST should
regardless be an array with no values?

Posted by Michael Austin on March 3, 2009, 7:36 pm


lawpoop wrote:


your browser is the only thing that generates the $_POST arrays but not
until you submit it and it LIVES on the client (your browser) and is
SENT to your server where php can READ, INTERPRET and RESPOND to it. You
are working with a REQUEST/RESPONSE paradigm... the client (browser)
sends a REQUEST to the server that RESPONDS by sending the data (HTML,
PHP etc...)

Posted by =?ISO-8859-1?Q?=22=C1lvaro_G=2 on March 4, 2009, 5:25 am


lawpoop escribió:



^Z
array(0) {
}

Wow! It exists even if there's no HTTP involved! ;-)


--
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://bits.demogracia.com
-- Mi web de humor al baño María: http://www.demogracia.com
--


Subject Author Date
FF triggering $_POST array even on no submission? lawpoop 03-03-2009
If you were  Registered and logged in, you could reply and use other advanced thread options

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Driving a better car - Fuelzilla.com

Cabling site for homeowners and pros alike - Cabling-Design.com

1-Script XML SitemapXML Sitemap
Privacy Policy