Welcome Guest, Not a member yet? Register   Sign In
Submitting does not populate post values for first time.
#1

[eluser]sustbird[/eluser]
Hi,

In my entry form, when i click on submit, it does not populate post value for first time. But if i click again, it works fine. In my controller, code is
Code:
$submit = $this->input->post('Submit');

      if ( $submit != false ) {
//check validation and save

}
else
{
//show new form
}
In my form the button code is:
Code:
<input class="btn" type="submit" name="Submit" value="Save">
and form action is:
Code:
in config: $config['base_url']    = "http://localhost/gprms";
..
$action_url = site_url() . "area/$action/";
...
action="<?php echo $action_url; ?>">

For first click, $submit gets no value and showing the form again...!

Please help me to get rid of this.
#2

[eluser]Rob Gordijn[/eluser]
for debugging:
Code:
var_dump($this->input->post('Submit'));
and check the result when you submit the first time.
#3

[eluser]sustbird[/eluser]
it gives output: 'boolean false'
#4

[eluser]brianw1975[/eluser]
something reeks of mismatched character case.

are you sure you don't have name="submit" or this->input->post('submit') ?

been a while but iirc you should still be able to do a var_dump($_POST)
#5

[eluser]Rob Gordijn[/eluser]
hmm, that was expected Smile
but we need something like string(x) "Save"

- check spelling
- do what Bryan says, a _POST dump
- check if the button is inside the form
(ow wait, thats dumb, if the submit is not in the form, the form wil never submit Smile )
#6

[eluser]sustbird[/eluser]
after my full day wasting, the problem at last identified..

in the 'Add New' button from which i go to entry form...
the form action was
Code:
'action='<?php echo $add_url; ?>'

after adding a / at the last of the url it now works!

New url becomes:
Code:
'action='<?php echo $add_url; ?>/'

Thanks for your reply and time.
#7

[eluser]sustbird[/eluser]
One more question...
what is the ideal case? should every url have a '/' at last?
#8

[eluser]Unknown[/eluser]
Hello,

I have same problem, I don't get post result.. and let's say
Code:
var_dump($this->input->post('submit'));
returns a bool(false) , don't have an idea why this is happening, maybe someone knows where is the problem?

Ok I found solution to this error Smile
I have edited my .htaccess file like this:
Code:
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_URI} ^system.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]
    RewriteCond %{REQUEST_URI} ^application.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>

<IfModule !mod_rewrite.c>
    ErrorDocument 404 /index.php
</IfModule>
And everything is working right now Wink
#9

[eluser]sustbird[/eluser]
Another reason for this problem, i have identified; that is mod_auth_sspi .
If you use mod_auth_sspi of version 1.0.4, change to 1.0.3.

Hope this helps.
#10

[eluser]bret[/eluser]
[quote author="Sauls" date="1272372336"]Hello,

I have same problem, I don't get post result.. and let's say
Code:
var_dump($this->input->post('submit'));
returns a bool(false) , don't have an idea why this is happening, maybe someone knows where is the problem?

Ok I found solution to this error Smile
I have edited my .htaccess file like this:
Code:
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_URI} ^system.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]
    RewriteCond %{REQUEST_URI} ^application.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>

<IfModule !mod_rewrite.c>
    ErrorDocument 404 /index.php
</IfModule>
And everything is working right now Wink[/quote]


I am coming across a similar issue with my post values not populating upon form submission (profiling shows no values for POST). Could anyone kindly explain what these rewrites are actually doing in this .htaccess file? I don't follow which one actually corrected the problem.
Thanks in advance




Theme © iAndrew 2016 - Forum software by © MyBB