[eluser]Lionel H[/eluser]
Hello,
I have a question which I didn't find any answer for in the forum : I have a form (a newsletter), and I want to use two submit inputs, one for previewing the newsletter, one for sending it.
I found this solution, but I have the feeling it's not the best way :
the view
Code:
...html code...
<?= form_open('newsletter/send') ?>
...html code...
<?= form_submit('send', 'Envoyer') ?>
<?= form_submit('preview', 'Prévisualiser') ?>
...html code...
the controller
Code:
function send()
{
$data = $_POST;
if(isset($data['send'])):
# code for sending the newsletter
elseif(isset($data['preview'])):
$this->load->view('includes/newsletter');
endif;
}
Ideally, I'd like each submit to send to its own controller ; does anybody know how to do this ? :-)