mardi 16 janvier 2018

I can't the contents of my checkbox (symfony 1.0)

Hi I have to work with Symfony 1 ( yeah i know it's pretty old ). I have to do a form where the user can enter multiple choice thanks to a checkbox. Except that when I check more than a checkbox, I only get the content of the last checkbox

I have this :

<tr>
        <th>Est prolongé :</th>
        <td>
        <?php echo checkbox_tag('motif', '1');  ?>
        </td>
    </tr>
<tr>
        <th>Est interrompu :</th>
        <td>
        <?php echo checkbox_tag('motif', '2'); ?>
        </td>
    </tr>




public function executeAddFormAvenant()
{
    sfLoader::loadHelpers('Url');
    // Enregistremant d'un nouvel avenant :
    $avenant=new ConvFormAvenant();
    $avenant->setIdConvConvention($this->getRequestParameter('id_convention'));
    $conv_convention = ConvConventionPeer::retrieveByPk($this->getRequestParameter('id_convention'));
    if ($this->getRequestParameter('motif')==1)
    {
        $avenant->setEstProlongé(1);
    } else{
        $avenant->setEstProlongé(0);
    }
    if ($this->getRequestParameter('motif')==2)
    {
        $avenant->setEstInterrompu(1);
    } else{
        $avenant->setEstInterrompu(0);
    }




Aucun commentaire:

Enregistrer un commentaire