Welcome Guest, Not a member yet? Register   Sign In
i am trying to do a wizard to post data in the db in the view
#1

[eluser]dinisptc[/eluser]
i am trying to do a wizard to post data in the db in the view


i am trying to record the step data in the sessions

Array ( [name] => projectName [id] => projectName [value] => [maxlength] => 45 [size] => 45 [placeholder] => Project name [class] => validate['required'] )

'value' => set_value('projectName'),

but this value its always empty


thanks

Code:
<form acti method="post">
  <h3>Basic information</h3>
  
  &lt;!--&lt;input type="text" name="name" id="name" placeholder="Project name" class="validate['required']" value="" /&gt;--&gt;

  &lt;?php


  /* input text projectName */
  $data = array(
       'name' => 'projectName',
       'id' => 'projectName',
       'value' =>  set_value('projectName'),
       'maxlength' => '45',
       'size' => '45',
                        'placeholder'=>'Project name',
                        'class'=>"validate['required']"
   );



echo form_label('Project Name', 'projectName');
echo br(1);
echo form_input($data);
$this->session->set_userdata($data);//= set_value('projectName');
print_r($data);
echo $this->session->userdata('projectName');
echo br(2);

?&gt;

    
  &lt;input type="text" name="adresse" id="adresse" placeholder="Adresse" class="validate['required']" value="" /&gt;
    
  &lt;input type="text" name="adresse2" id="adresse2" placeholder="Complément d'adresse" class="validate['']" value="" /&gt;
    
  &lt;input type="text" name="postcode" id="postcode" placeholder="Code postal" class="validate['digit','length[8,-1]']" value="" /&gt;&lt;input type="text" name="city" value="" placeholder="Localité" class="validate['required']" id="city" />
  
  <select name='pays'>
   &lt;?php require_once(APPPATH.'inc/listePays-fr.inc.php'); ?&gt;
  </select>
  
  <h3>Avatar</h3>
  <p>Vous pouvez choisir une image comme icône pour le projet.<br>
  Cette image sera utilisé dans l'interface web et dans l'application iPad.
  </p>
  &lt;input type="file" name="avatar" id="avatar" value="Project avatar" placeholder="Project avatar"&gt;
  
  <h3>Project manager</h3>
  <p>Choisissez parmi vos utilisateurs enregistrés le ou les responsables du projet.<br>
  Les utilisateurs sélectionnées auront accès au projet et pourront le synchroniser
  </p>
  
  &lt;input type="checkbox" value="userUID"&gt; User1 firstname Name <br>
  &lt;input type="checkbox" value="userUID"&gt; User2 firstname Name <br>
  &lt;input type="checkbox" value="userUID"&gt; User3 firstname Name <br>
  &lt;input type="checkbox" value="userUID"&gt; User4 firstname Name <br>
  
  &lt;input type="submit" class="submit" value="next step" /&gt;
  
&lt;/form&gt;
#2

[eluser]TheFuzzy0ne[/eluser]
That's what I'd expect to happen. Since your data is not yet in the $_POST array, there's nothing for set_value() to use. You can pass in a second parameter to set_value(), which is the default value to use in the event that the form has not been posted:

Code:
$data = array(
    /* ... */
    'value' =>  set_value('projectName', $this->session->userdata('projectName')),
    /* ... */
);

Hope this helps.




Theme © iAndrew 2016 - Forum software by © MyBB