Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>in your <code>_do_upload</code> function you do not pass the argument at the function, it can't use <code>$field_name</code> Try to change it:</p> <pre><code>public function _do_upload($field_name) </code></pre> <p>There are different problem into your code. First of all you load the view before the validation, in this way the view is always diplaied. Try my following code (just the index function):</p> <pre><code>function index() { $this-&gt;load-&gt;library('form_validation'); //loading validation library $this-&gt;form_validation-&gt;set_rules('username','username','Rquired'); //setting rules for validation $this-&gt;form_validation-&gt;set_rules('password','password','required|md5|trim'); $this-&gt;form_validation-&gt;set_rules('passconf','password confirmation','required|md5|trim'); $this-&gt;form_validation-&gt;set_rules('datepicker','date','required'); $this-&gt;form_validation-&gt;set_rules('email','email','required'); $this-&gt;form_validation-&gt;set_rules('userfile', 'Image', 'callback__do_upload'); //userfile is the upload file field name in form , if($this-&gt;form_validation-&gt;run()!=false) { //Get the info from the form $username = $this-&gt;input-&gt;post('username'); $password = $this-&gt;input-&gt;post('password'); $passconf = $this-&gt;input-&gt;post('passconf'); $date = $this-&gt;input-&gt;post('datepicker'); $email = $this-&gt;input-&gt;post('email'); $temp=$this-&gt;upload-&gt;data(); $image=$temp['file_name'];// to get image file name rom upload script , as it could be stored in the databae //load the model $this-&gt;load-&gt;model('file_model'); //execute the registration query $data = $this-&gt;file_model-&gt;register_user($username,$password,$passconf,$date,$image,$email); //if $data == TRUE if($data) { echo "you have successfully made your registration"; } else { echo "faillled"; } } else{ //You arrived here just in case the form fields are not correct $this-&gt;load-&gt;view('register_form'); //loading reg form here } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload