Welcome Guest, Not a member yet? Register   Sign In
Check if form has been submitted?
#9

[eluser]built2fall[/eluser]
Here's two other methods to determine if a form has been submitted:

Code:
if ($this->input->server('REQUEST_METHOD') === 'POST')
{
// do something
}

OR

if ($this->input->post('hidden_form_field'))
{
// do something
}

Checking for a existence of a hidden form in POST, this method, and counting the size of the POST array are probably the most foolproof methods. I didn't verify this but going by what I've read, IE allows for form submissions by hitting enter without focus on the submit button, so in that case checking for $_POST['submit-btn'] would fail. Also if you enabled GET, checking the REQUEST_METHOD wouldn't work in the case of someone not submitting the form and just typing the URL with the query string.


Messages In This Thread
Check if form has been submitted? - by El Forum - 01-27-2009, 11:22 AM
Check if form has been submitted? - by El Forum - 01-27-2009, 03:22 PM
Check if form has been submitted? - by El Forum - 01-27-2009, 08:01 PM
Check if form has been submitted? - by El Forum - 01-27-2009, 08:32 PM
Check if form has been submitted? - by El Forum - 01-28-2009, 10:09 AM
Check if form has been submitted? - by El Forum - 01-28-2009, 10:39 AM
Check if form has been submitted? - by El Forum - 01-28-2009, 10:40 AM
Check if form has been submitted? - by El Forum - 01-28-2009, 10:47 AM
Check if form has been submitted? - by El Forum - 03-28-2010, 09:12 PM
Check if form has been submitted? - by El Forum - 05-05-2010, 10:49 AM



Theme © iAndrew 2016 - Forum software by © MyBB