0

I'm trying to make a codeigniter form, but when I press the button nothing happen. I've already checked everything a thousand time but nothing happen.

Here is the form code:

 $this->load->helper('form'); $this->load->helper('captcha'); $attributs = array('class' => 'col-md-12 col-xs-12', 'id' => 'inscription'); echo form_open('utilisateur/ajouter', $attributs); echo "Nom <br>".form_input('nom','test')."<br>"; echo "Prénom <br>".form_input('prenom','test')."<br>"; echo "Age <br>".form_input('age','test')."<br>"; echo "Pseudo <br>".form_input('pseudo','test')."<br>"; echo "Email <br>".form_input('email','test')."<br>"; echo "Mot de passe <br>".form_password('mdp','test')."<br>"; echo "Confirmation <br>".form_password('mdpConf','test')."<br>"; $bouton = array( 'name' => 'button', 'class' => 'button', 'content' => 'Valider !' ); echo "<br>".form_button($bouton); echo form_close(); 

And the controller called code:

 class Utilisateur extends CI_Controller { protected $Pseudo; protected $Email; protected $Nom; protected $Prenom; protected $Age; protected $DateInscription; public function __construct() { parent::__construct(); $this->Pseudo=$Pseudo; $this->Email=$Email; $this->Nom=$Nom; $this->Prenom=$Prenom; $this->Age=$Age; $this->DateInscription=$DateInscription; } public function ajouter() { redirect('pages/view/accueil/', 'location'); } } 
2
  • Can you include more detail about your desired behavior? Also, how can you tell nothing is happening? Commented Oct 23, 2015 at 17:27
  • Your button does now have any type => "submit" Commented Oct 24, 2015 at 1:02

2 Answers 2

1

I haven't used codeignitor for quite some time, but surely if you want to submit the form you should be using form_submit($bouton); rather than form_button($bouton);

Sign up to request clarification or add additional context in comments.

Comments

0

use form_submit(),

echo form_submit('mysubmit', 'Submit Post!'); 

Would produce:

<input type="submit" name="mysubmit" value="Submit Post!" /> 

In your case,

form_submit($bouton); 

would produce

<input type="submit" content="Valider !" class="button" value="" name="button"> 

Is Anything missing??

Answer is yes.

What?

Value to submit button.

$bouton = array( 'name' => 'button', 'class' => 'button', 'content' => 'Valider !',//this will work for button, not submit button. 'value' => 'Valider !' ); 

For more reference, see this

4 Comments

Ok thanks it's working with form_submit, and even with the value added to the submit button it doesn't work.
Without value what are you getting as value??
I ment form_button not submit button, it never work apparently, so nothing. Anyway it's working with form_submit so who cares, thanks :)
for normal button, content will work, but for submit button, it will not work.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.