0

I am stuck and cannot seem to figure my issue out. I am trying to write a basic "Contact Us Form" using Codeigniter for the first time. My form on my view looks like this..

<div style='float: left; padding-right: 55px; padding-left: 35px;'>
    <?php 
        $this->load->helper('form'); 
        echo form_open('pages/emailsender'); ?>

        Contact Us:<br />
        <?php 
        echo form_input('name', 'Enter Your Name');
        echo form_input('email', 'Enter Your Email'); 
        echo "<br />";
        echo form_textarea('message', 'Enter your message here, thanks for taking the time to contact us!');
        echo "<br />";
        echo form_submit('submit', 'Send Message!');
        echo form_reset('reset', 'Reset Form');
        echo form_close();
        ?>
</div>

and my controller pages.php looks like this..

<?php

class Pages extends CI_Controller {

    public function index(){

        $this->load->view('templates/header');
        $this->load->view('home');
        $this->load->view('templates/footer');
    }

    public function home(){

        $this->load->view('templates/header');
        $this->load->view('home');
        $this->load->view('templates/footer');
    }

    public function about(){

        $this->load->view('templates/header');
        $this->load->view('about');
        $this->load->view('templates/footer');
    }

    public function services(){

        $this->load->view('templates/header');
        $this->load->view('services');
        $this->load->view('templates/footer');
    }

    public function reviews(){

        $this->load->view('templates/header');
        $this->load->view('reviews');
        $this->load->view('templates/footer');
    }

    public function specials(){

        $this->load->view('templates/header');
        $this->load->view('specials');
        $this->load->view('templates/footer');
    }

    public function contact(){

        $this->load->view('templates/header');
        $this->load->view('contact');
        $this->load->view('templates/footer');
    }

    public function emailsender(){
        $this->load->view('templates/header');
        $this->load->view('contact');
        $this->load->view('templates/footer');
    }

}

I have the "emailsender" function just redirecting me back to the same page as a test, but it won't even do that?! I get a "No input file specified." error every time. I read this post on stackoverflow Codeigniter no input file specified error but it doesn't seem to resolve my issue. My config file looks like this..

/*
|--------------------------------------------------------------------------
| Base Site URL
|--------------------------------------------------------------------------
|
| URL to your CodeIgniter root. Typically this will be your base URL,
| WITH a trailing slash:
|
|   http://example.com/
|
| If this is not set then CodeIgniter will guess the protocol, domain and
| path to your installation.
|
*/
$config['base_url'] = 'http://mywebsitename.com';
$config['index_page'] = ""; 
$config['uri_protocol'] = "AUTO"; 

any ideas why I am getting the No input file specified error?

Community
  • 1
  • 1
ErinSKabbash
  • 389
  • 3
  • 4
  • 13

4 Answers4

7

Change your .htaccess to look like this

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]

Notice the ? mark in the last line. Previously this line was something like this RewriteRule ^(.*)$ index.php/$1 [L]

Also make sure to add this line RewriteBase / in your .htaccess

Khawer Zeshan
  • 9,470
  • 6
  • 40
  • 63
  • I did as you said but I am still having the same error. My .htaccess file is now: `code`RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?/$1 [L,QSA]`code` I am on a GoDaddy Server, I do not know if that has anything to do with it. But I had to make some changes to the .htaccess file to get the site to even load in the first place on GoDaddy. I replaced those with what you said though and the site still loads but still getting the error on the contact form. – ErinSKabbash Oct 11 '13 at 21:39
  • When I click the submit button it sends me to /index.php/pages/emailsender and displays the "No input file specified." error. – ErinSKabbash Oct 11 '13 at 21:46
2

Change Your .htaccess like that

<IfModule mod_rewrite.c>

Options +FollowSymLinks
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]

</IfModule>

Hope It will works for you... thanks

Robin Hossain
  • 711
  • 9
  • 12
0

Change:

 echo form_open('pages/emailsender'); ?>

To:

echo form_open_multipart('pages/emailsender'); ?>

form_open_multipart adds the enctype="multipart/form-data" to the form tag.

Nil'z
  • 7,487
  • 1
  • 18
  • 28
0

You need to use the direct link instead of the short hand of the form open tag. Like this:

echo form_open(‘http://example.com/welcome/emailsender’);

instead of this:

echo form_open(‘welcome/emailsender’);
Flexo
  • 87,323
  • 22
  • 191
  • 272
ErinSKabbash
  • 389
  • 3
  • 4
  • 13