samedi 7 mars 2015

Why i cannot get POST values?

This is my form, that is dynamically generated:



<form action='index.php?direction=saveUserPreferences' method='post'>
<label>Office space<input type='checkbox' name='userInterest[]' value='1' id='1'></label>
<label>Grants<input type='checkbox' name='userInterest[]' value='2' id='2' checked></label>
<label>Loans<input type='checkbox' name='userInterest[]' value='3' id='3'></label>
<label>Events<input type='checkbox' name='userInterest[]' value='4' id='4' checked></label>
<label>Connecting<input type='checkbox' name='userInterest[]' value='5' id='5' checked></label>
<label>Office administration<input type='checkbox' name='userInterest[]' value='6' id='6' checked></label>
<label>TAX<input type='checkbox' name='userInterest[]' value='7' id='7' checked></label>
<label>Self employment<input type='checkbox' name='userInterest[]' value='8' id='8' checked></label>
<label>Start up<input type='checkbox' name='userInterest[]' value='9' id='9' checked></label>
<label>Banks<input type='checkbox' name='userInterest[]' value='10' id='10' checked></label>
<input type='text' name='name' id='name'/>
<input type='submit' name='sendData' value='Save'/>


Form points to controller function:



public function saveUserPreferences() {
var_dump($_POST);

}


I tried checking whether post is set etc, and i cannot get array from the post.


I have also login form, that points to the same controller and another function, and it works fine. So i know controller file can and do receive post values.


But for some strange reason, for this particular form i cannot get any values. I have looked up another questions and answers, but cannot get this thing to work.I am also familiar with: PHP tutorial about the forms


Following that solution i get unidentified index error. Is there something i miss?


Thanks in advance for any tips and tricks ;)


Aucun commentaire:

Enregistrer un commentaire