0

i made a controller name of user.php i test complete project on local host it works fine but when i upload online on website it shows error , i submit the form then form load controller called user.php and error on the first line its called parse error i check but still the same will you please suggest.

<?php 

class User extends CI_Controller {

                function __construct()
                {
                parent::__construct();
                $this->load->helper('form');
                $this->load->helper('url');
                }

public function create_user()
            {
            // field name, error message, validation rules
            $this->form_validation->set_rules('email', 'Email', 'trim|required|valid_email');
            $this->form_validation->set_rules('city', 'City', 'trim|required');     
            if($this->form_validation->run() == FALSE)
            {
            $this->load->view('ar_signup');
            }
            else
            {           
            $this->load->model('Users_model');
            if($this->input->post("language")=="ar")
            {
            $this->load->view('ar_thanks');
            }
            else
            {
            $this->load->view('en_thanks');
            }
            if($query = $this->Users_model->create_member())
            {
            $this->load->view('ar_thanks');         
            }
                }               
                        }

    }   
8
  • Specify detailed error Commented Jan 14, 2014 at 8:50
  • This question appears to be off-topic because it is abou Commented Jan 14, 2014 at 8:51
  • @Formal you need to provide the detail information of error coming, Parse error is type of error but you have not specified that what is the error. Commented Jan 14, 2014 at 8:53
  • Adarsh i just get error in this file Parse error: syntax error, unexpected $end in, thats why i share complete code of file because i end the php and all curly bracket but still shows error. Commented Jan 14, 2014 at 8:54
  • **Parse error: syntax error, unexpected $end in ** this error coming web i submit form. Commented Jan 14, 2014 at 8:55

1 Answer 1

0

Please format your code and use IDE. And you will not have these errors. Your formatted code:

<?php
class User extends CI_Controller {

    function __construct()
    {
        parent::__construct();
        $this->load->helper('form');
        $this->load->helper('url');
    }

    public function create_user()
    {
        // field name, error message, validation rules
        $this->form_validation->set_rules('email', 'Email', 'trim|required|valid_email');
        $this->form_validation->set_rules('city', 'City', 'trim|required');
        if($this->form_validation->run() == FALSE) {
            $this->load->view('ar_signup');
        } else {
            $this->load->model('Users_model');
            if($this->input->post("language")=="ar") {
                $this->load->view('ar_thanks');
            } else {
                $this->load->view('en_thanks');
            }
            if($query = $this->Users_model->create_member()) {
                $this->load->view('ar_thanks');
            }
        }
    }
}
Sign up to request clarification or add additional context in comments.

1 Comment

as you mention the code i use the same but still same error i recv Parse error: syntax error, unexpected T_STRING in /home/gifto/public_html/landingpage/application/controllers/user.php on line 1, but this error when i upload file for online server i run this file on local server it works fine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.