Welcome Guest, Not a member yet? Register   Sign In
Post values not populated after form submit.
#1

[eluser]sustbird[/eluser]
I have a form. When i submit, post values are not populated.
My form code is:
Code:
<?php
   $this->load->helper('url');
   $add_url =  site_url().'risk_close/add';
   var_dump($_POST);
?>

<h1 align="center" >Period Closing</h1>

<br />
<div id="pagination">
<table style="border: 1px solid gray" class="tbl" border="0" cellpadding="2" cellspacing="1" width="100%">
<thead>
<tr class="grid_header">
    
    <th VALIGN='MIDDLE' ALIGN='CENTER'  class='tbl_headercell'>
        Closed By
    </th>
    <th VALIGN='MIDDLE' ALIGN='CENTER'  class='tbl_headercell'>
        Closing Date
    </th>

</tr>
</thead>
<tbody>

      &lt;?php $i = 0;
         foreach ($risk_close_list as $risk_close) {
            $i++;
            if (($i%2)==0) { $bgColor = "#FFFFFF"; } else { $bgColor = "#EFF5FB"; }
      ?&gt;
      <tr bgcolor="&lt;?php echo  $bgColor; ?&gt;">
        
       <td align="left" nowrap="nowrap">&lt;?php echo  $risk_close['closed_by']; ?&gt;</td>
       <td align="left" nowrap="nowrap">&lt;?php echo  $risk_close['closing_date']; ?&gt;</td>
    </tr>
      &lt;?php } ?&gt;
</tbody>
</table>
<br /><div class="pagination">&lt;?php echo $page_links;?&gt;</div>
</div>

&lt;form action='&lt;?php echo $add_url; ?&gt;' method='POST'&gt;
<table width="100%" border="0" cellspacing="1" cellpadding="0">
<tr>
    <td align="center">
&lt;input class="btn" type="submit" name="Submit" value="Close Current Period"&gt;

   </td>
</tr>
</table>
&lt;/form&gt;

In my controller, my code is:
Code:
function add() {

      $this->load->helper('url');
      $this->load->helper('lookup');

      $submit = $this->input->post('Submit');

      if ( $submit != FALSE) {
    // do db operation...        
      }
      else {
        $_SESSION['fmessage'] = 'Period Closing not submitted.';
            
             redirect('/risk_close/', 'location');

      }
   }

After submitting, it shows: 'Period Closing not submitted.' i.e $submit value not pupulated!

I am stuck with this. Please help.
#2

[eluser]maria clara[/eluser]
[quote author="sustbird" date="1266324260"]

In my controller, my code is:
Code:
function add() {

      $this->load->helper('url');
      $this->load->helper('lookup');

      $submit = $this->input->post('Submit');

      if ( $submit != FALSE) {
    // do db operation...        
      }
      else {
        $_SESSION['fmessage'] = 'Period Closing not submitted.';
            
             redirect('/risk_close/', 'location');

      }
   }

[/quote]

try putting print_r($_POST);

Code:
function add() {

      $this->load->helper('url');
      $this->load->helper('lookup');

print_r($_POST);  // so you could see what is in SUBMIT not posting
      $submit = $this->input->post('Submit');

      if ( $submit != FALSE) {
    // do db operation...        
      }
      else {
        $_SESSION['fmessage'] = 'Period Closing not submitted.';
            
             redirect('/risk_close/', 'location');

      }
   }

i advise you to use firebug to see your error in the console.
#3

[eluser]sustbird[/eluser]
print_r($_POST); gives an empty array.

One strange thing is that, if i click multiple times, randomly sometime this value is populated and most of the time it does not. It is so fraustrating.........Sad
#4

[eluser]maria clara[/eluser]
[quote author="sustbird" date="1266327968"]print_r($_POST); gives an empty array.

One strange thing is that, if i click multiple times, randomly sometime this value is populated and most of the time it does not. It is so fraustrating.........Sad[/quote]

ahh ok. your post is empty that's why its not populating. please post your code.
#5

[eluser]sustbird[/eluser]
Hi clara,
I have given my code on my post above. I have tested on firefox, where it works perfectly! But my users are on IE7 based.

I am astonished why PHP is puzzled with browser??

Please suggest what should i do now.




Theme © iAndrew 2016 - Forum software by © MyBB