开发者

CodeIgniter send()) fail

开发者 https://www.devze.com 2023-04-13 06:47 出处:网络
I am learning how to use code igniter and following tutorials. As this is my first time to use MVC, I\'m having some trouble implementing the send function. I am doing a tutorial on how send a newslet

I am learning how to use code igniter and following tutorials. As this is my first time to use MVC, I'm having some trouble implementing the send function. I am doing a tutorial on how send a newsletter sign up form.

For some reason when I hit submit wit开发者_开发问答h or without the info, its giving me a 404 page not found with the /send extension. Is there something I'm missing in my config file?

Here is the code

Thanks in advance.


Is not send that is failing but you missed something in your config.

http://codeigniter.com/user_guide/general/urls.html

You should set up your .htaccess according to the guide above.


Did you setup the CodeIgniter rewrite rules in your .htaccess?


Apart from the htaccess possible problem, there are a couple of things wrong in the file you posted:

1) the html <title>HEY<title> before the php class, but I hope that's a typo, right? you don't have html in your controller file, right?

2) You're getting the POST variable wrong; or better, you're confusing and mixing things. Instead of

$this->input->$_POST('name');  //which is also sintactically wrong

should be:

$this->input->post('name').

The input class already does the retrieving of this superglobal. And unsets them in favour of its own.

3) To use an attachment, you need to call

$this->email->attach($filename);

You just declared a variable and nothing else.

4) What is $this->email->set_newline("\r\n"); ? I don't see this function in the email class...You need to use a config file for this, or pass the value on library's inizialization:

$config['newline'] = "\r\n";
$this->email->initialize($config);
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号