CodeIgniter Forums
Difficulty sending email 404 error - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Difficulty sending email 404 error (/showthread.php?tid=32885)



Difficulty sending email 404 error - El Forum - 08-08-2010

[eluser]Unknown[/eluser]
Hi guys,

I'm having trouble getting an email to send because I keep getting a 404 error when I press the submit button. I'm not sure if it isn't the second function in my main controller.

Here is my code so far home.php
Code:
<!--
Name: INSERT
Date: INSERT
File: INSERT
Desc: INSERT
-->

<?php



    class Home extends Controller{
    
        function index(){
        
            $this->load->view('home_view');
            return true;
        }

        function sendemail(){
            $to = $this->input->post('you');
            $subject = $this->input->post('subject');
            $message = $this->input->post('contactbody');
            
            mail($to, $subject, $message);
            $this->load->view('home_view');
            
        }
        
    
    }

Here is the part of the html that I think is of note, if you need any more info please let me know.
Code:
<div class="divider" id="contact">
                    <p class = "header"><a name="gocontact">Contact</a></p>
                       &lt;form method = "post" id="contactform" action="&lt;?php base_url()?&gt;/sendemail"&gt;
                           <div id ="formtitles">
                               <p class = "info">You:</p>
                               <p class = "info">Me:</p>
                               <p class = "info">Subject:</p>
                               <p class = "info">Body:</p>
                               &lt;input type="submit" value="Send" /&gt;
                           </div>
                           <div id ="formfields">
                               &lt;form&gt;
                               &lt;input id="you" type="text" name="you" /&gt;&lt;br/>
                               <p class = "info">Here is some info</p>
                               &lt;input id ="subject" type="text" name="subject" /&gt;&lt;br/>
                               &lt;textarea id = "contactbody"&gt;&lt;/textarea>
                           </div>
                       &lt;/form&gt;
                </div>