shyr77 Posted August 4, 2011 Share Posted August 4, 2011 help! something wrong with my code and I don't know what's wrong. here's my code: <?php class Welcome extends Controller { function Welcome() { parent::Controller(); $this->load->model('captcha_model'); } function index() { $this->captcha_model->generateCaptcha(); } if ($this->input->post('code') <> $this->session->userdata('captcha_key')) { echo 'error in captcha code'; } else { echo 'success'; } } ?> and here's the error: Parse error: syntax error, unexpected T_IF, expecting T_FUNCTION in C:\xampp\htdocs\CAPTCHA_app\system\application\controllers\welcome.php on line 16 Hope someone could help me. Link to comment https://forums.phpfreaks.com/topic/243755-parse-error-syntax-error-unexpected-t_if-expecting-t_function-in-cxampphtd/ Share on other sites More sharing options...
trq Posted August 4, 2011 Share Posted August 4, 2011 This: if ($this->input->post('code') <> $this->session->userdata('captcha_key')) { echo 'error in captcha code'; } else { echo 'success'; } Cannot be in your class like that, it need to go in a method. Link to comment https://forums.phpfreaks.com/topic/243755-parse-error-syntax-error-unexpected-t_if-expecting-t_function-in-cxampphtd/#findComment-1251570 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.