Sending a Code to an Email Address in CodeIgniter |
I can't get the finding of the code to work. I can get the email address and code inserted into the database.
And I've tried sending an email with the code from localhost but I guess that does not work so I'll leave that until I get a server. I can copy the code from the database and paste it into the text box but I get this error - An uncaught Exception was encountered - Type: Error - Method name must be a string This is the coding; Controller PHP Code: class Code extends CI_Controller { Model PHP Code: class Code_model extends CI_Model Can somebody explain where I'm going wrong?
You have this code in your controller:
PHP Code: $code = $this->input->post('code'); If you refer to $this-> .... it can either be a variable that has been declared for the class you're working in (the controller for instance), or a method ( = function) inside that class. If it's a class level variable, it's $this->code. If it's a class level method, it's $this->code(). In both cases, $this->$code is wrong. I think you simply want to check if the variable $code is equal to the literal string 'pass_word'. So it should be: PHP Code: $code = $this->input->post('code');
(05-23-2017, 08:18 AM)Wouter60 Wrote: You have this code in your controller: OK, thanks but it loads this; PHP Code: $this->load->view('codeincorrect'); I want it to load that only if the code is wrong. If the code is correct I want it to load PHP Code: $this->load->view('username'); There maybe something wrong in the Model.
Your controller doesn't do anything with the model, except loading it. There is no call to the function find_code() in your controller.
(05-23-2017, 02:02 PM)Wouter60 Wrote: Your controller doesn't do anything with the model, except loading it. There is no call to the function find_code() in your controller. I need to be hand fed. I'm having to guess & test each step because I cant find anywhere to learn. I've inserted this line into the controller below the model load; PHP Code: $this->find_code(); but get this error "Call to undefined method Code::find_code()"
(05-24-2017, 10:23 PM)christaliise Wrote: SOME HELP WOULD BE APPRECIATED. https://www.codeigniter.com/userguide3/o...arted.html
(05-25-2017, 02:59 AM)Wouter60 Wrote:(05-24-2017, 10:23 PM)christaliise Wrote: SOME HELP WOULD BE APPRECIATED. The userguide is not the place to learn, it is designed for the "intermediate PHP programmer". https://www.codeigniter.com/userguide3/t...usion.html Every intermediate PHP programmer should be able to get the hang of CodeIgniter within a few days. If you still have questions about the framework or your own CodeIgniter code, you can: Check out our forums - Yeah right!
If you have no basic knowledge of php, and you don't want to invest time to learn the basics of CodeIgniter, you won't get much help here. You say you need to be hand fed. That's not what you can expect here. Other users will be annoyed by questions that have an obvious answer in the CI documentation which is actually very good. There are few web frameworks so well documented as CI.
(05-25-2017, 08:52 AM)Wouter60 Wrote: If you have no basic knowledge of php, and you don't want to invest time to learn the basics of CodeIgniter, you won't get much help here. You say you need to be hand fed. That's not what you can expect here. Other users will be annoyed by questions that have an obvious answer in the CI documentation which is actually very good. There are few web frameworks so well documented as CI. I do have a basic knowledge of PHP and I have spent considerable time studying the basics of CodeIgniter, as I've managed to build 4 pages already, 2 complete, and I only ask questions when I'm absolutely exhausted from searching the Internet. So where are the "obvious answers"? |
Welcome Guest, Not a member yet? Register Sign In |