CodeIgniter Forums
crazy multiple submit problem - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: crazy multiple submit problem (/showthread.php?tid=13194)



crazy multiple submit problem - El Forum - 11-14-2008

[eluser]charlie spider[/eluser]
in the administrative backend for a product page, i have all of the product details on one page.
it is broken up into multiple forms so that minor edits to one section of the product details do not have to submit and process the entire page's worth of data.

i'm using the standard CI form validation, so the forms submit back to the same controller for the page that the forms are on.
my view looks like this:
Code:
$attributes = array('name' => 'boot_text1', 'id' => 'boot_text1');
echo form_open('boot/' . $boot->bootID, $attributes);    
// input stuff here
echo form_submit('submit_text', 'Update Boot Text' );
echo form_close();

// more forms here

$attributes = array('name' => 'boot_image1', 'id' => 'boot_image1');
echo form_open_multipart('boot/' . $boot->bootID, $attributes);    
// input stuff here
echo form_submit('submit_image1', 'Upload Image' );
echo form_close();

// more forms here

$attributes = array('name' => 'size_chart', 'id' => 'size_chart');
echo form_open('boot/' . $boot->bootID, $attributes);
// input stuff here
echo form_submit('submit_sizechart', 'Update Size Chart' );
echo form_close();


in the controller i set the rules based on which submit button has been pressed, like this:

Code:
if ($this->input->post('submit_text'))
{                    
  $rules['nmbr'] = "trim|required|min_length[2]|max_length[12]";
  $rules['name'] = "trim|required|min_length[4]|max_length[24]";
  $rules['shortDesc'] = "trim|max_length[2048]";
  $rules['longDesc'] = "trim|required|max_length[4096]";                    
  $this->validation->set_rules($rules);                
}

// rule setting for other forms here

if ($this->input->post('submit_image1'))
{                    
  $rules['pic1'] = "trim|max_length[256]";
  $this->validation->set_rules($rules);                
}

// rule setting for other forms here

if ($this->input->post('submit_sizechart'))
{        
  $rules['size_chart'] = "";                    
  $this->validation->set_rules($rules);
}

then i set the fields:

Code:
$this->validation->set_error_delimiters('<div class="error">', '</div>');
                
$fields['nmbr']    = 'Boot Number';
$fields['name']    = 'Boot Name';
$fields['shortDesc'] = 'Short Description';
$fields['longDesc'] = 'Long Description';
$fields['pic1']    = 'Boot Image 1';

// field setting for other forms here
            
$this->validation->set_fields($fields);

then get down to business (finally)
and just like with the rules, i test for which submit button has been pressed, and then process the data for that form

Code:
if ( $this->validation->run() == FALSE )
{
  $this->load->view('boot_details', $this->data);
}
else
{
  if ($this->input->post('submit_text'))
  {
    // code to update text
  }            
  else if ( $this->input->post('submit_image1')
  {
    $this->do_upload();
  }

// other form stuff here

  else if ($this->input->post('submit_sizechart'))
  {
    // process size chart
  }
}



So here's the BIG problem...

This works perfectly on my localhost, but when uploaded to the live server, everything works perfectly except the last form for the size chart !!!

what's weird is that it doesn't even register the last form being submitted.
so if i do this:

Code:
if ($this->input->post('submit_sizechart'))
{        
  die("you're momma is a chimp");
  $rules['size_chart'] = "";                    
  $this->validation->set_rules($rules);
}

it just sails on past as if the page loaded normally


now...

things that you might suggest after reading the above:

1) the rules for the size chart are set to nothing !!!
Code:
$rules['size_chart'] = "";
answer: so are rules for other forms that i didn't show here, and they all work fine.

2) you didn't put anything for set_fields for the size chart !!!
answer: same as #1 above. other forms have nothing for set_fields and work fine.

3) are you getting any errors ?
answer: nope! $this->validation->error_string is blank. it doesn't even hit the validation, it acts as if the the page was loading for the first time without hitting a submit button.

4) is your momma really a chimp ?
answer: no. but they may share a common ancestor from a couple hundred million years ago.



other info that may help...

the size chart is a huge mass of 230 radio buttons that are grouped in sets of three, that represent the three availability options for each boot size/width that the manufacturer has

again, this works perfectly on my localhost, i can change any of the size chart radio buttons, hit submit and the database is accurately updated. i also do not believe that this has anything to do with it because the problem seems to be with the submission of the form altogether and not the contents of the form.

i'm hoping it's something really simple that i have been overlooking because i've been staring at it for way too long now. and i am blonde, so the obvious does sometimes elude me.

anyways, i hope somebody out there can think of something that might help me.
i'm really really stumped.

thanks in advance for any and all help


crazy multiple submit problem - El Forum - 11-14-2008

[eluser]charlie spider[/eluser]
is there a limit to the amount of post data you can transmit in a regular form post ?

that form has to submit 2 arrays that are each 230 units in length
the one array will contain either a 0, 1, or 2
and the other will be a table id number anywhere from 1 to around 6,000 or so

i can't see that being too big to transmit via post though

any thoughts ?


crazy multiple submit problem - El Forum - 11-14-2008

[eluser]julgus[/eluser]
have you validated the html output using w3.org? run the output through the validator to ensure that nothing is wrong with the html.

check if the output from your localhost differs from the other server.

Let us know the result.
Regards


crazy multiple submit problem - El Forum - 11-14-2008

[eluser]charlie spider[/eluser]
it is in a password protected backend for the site, so the validator can not access it. My local tools for validating say it is good, although they tend to not be as ridiculously strict as the w3c validator.

anyways, i tried commenting out all of the checkboxes to see if the submit will work and it does !!!

so i think the post is choking on the size of the two arrays that are being sent, although again, they aren't that big as far as i'm concerned.

i also looked at my localhost php.ini file and found this:
Code:
; Maximum size of POST data that PHP will accept.
post_max_size = 16M
so i am now trying to get in contact with the hosting company to find out what they have it set at, and if i can get it raised.