Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8934333
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T09:45:47+00:00 2026-06-15T09:45:47+00:00

I am trying to work with https://github.com/jackilyn/bootstrap-contact/ to add a bootstrap contact form to

  • 0

I am trying to work with https://github.com/jackilyn/bootstrap-contact/ to add a bootstrap contact form to my codeigniter project.

The form is submitted as follows:

<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>" id="contactform">

after submission and validation, the following code is used to email the contact info:

//If there is no error, send the email
    if(!isset($hasError)) {
    $emailTo = 'you@yourwebsite.com'; // Put your own email address here
    $body = "Name: $name \n\nEmail: $email \n\nPhone Number: $phone \n\nSubject: $subject \n\nComments:\n $comments";
    $headers = 'From: My Site <'.$emailTo.'>' . "\r\n" . 'Reply-To: ' . $email;

    mail($emailTo, $subject, $body, $headers);
    $emailSent = true;
}

I don’t like the way the php code is included in the page itself and would like to move it to a seperate controller for security. How can I manage the program flow so that after the form is submitted with no errors , the flow is directed to a controller so I can execute the emailing code there instead , while keeping the form pointing to itself?

Thanks in advance,

Bill

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T09:45:48+00:00Added an answer on June 15, 2026 at 9:45 am

    hi please check i have created contact us controller and view for you really simple

    controller
    http://scrp.at/bYk

    class contact extends CI_Controller{
    
        function index(){
    
            $this->validation->rules('name','Name', 'required|trim');
            $this->validation->rules('email','Email', 'required|trim|vaild_email');
            $this->validation->rules('message','Message', 'required|trim');
    
            if(!$this->validation->run()){
                $this->load->view('form_view');
            }
            else{
                $this->send();  
            }
    
        }
    
        function send(){
            $this->load->library('email');
    
            $input = $this->input->post();
    
            // will extract all variables from post array
            extract($input);
    
            $this->email->from($email, $name);
            $this->email->to('admin@example.com');
            //$this->email->cc('another@another-example.com');
            //$this->email->bcc('them@their-example.com');
    
            $this->email->subject('Email Test');
            $this->email->message($message);
    
            $this->email->send();
    
            //echo $this->email->print_debugger();
    
            redirect('redirect-to-thank-you');
        }
    
    }
    

    view
    http://scrp.at/bYl

    <?
    echo form_open(uri_string());
    echo form_label('Name','name').form_input('name',set_value('name')).form_error('name').br();
    echo form_label('Email','email').form_input('email',set_value('email')).form_error('email').br();
    echo form_label('Message','message').form_textarea('message',set_value('message')).form_error('message').br();
    echo form_close();
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to work on a git hub project source code: https://github.com/esheri3/OWASP-CSRFGuard However
I'm trying to get the jQuery Mobile events( https://github.com/jquery/jquery-mobile/blob/master/js/jquery.mobile.event.js ) to work as a
So I'm trying to get the oauth authlogic plugin (https://github.com/jrallison/authlogic_oauth) to work on my
Trying to use gem delayed_job from collectiveidea(https://github.com/collectiveidea/delayed_job) in my project, but it throws exception:
I'm trying to install OpenCV for PHP but it doesn't work. https://github.com/mgdm/OpenCV-for-PHP I did
I'm trying to use this widget ( https://github.com/johannilsson/android-pulltorefresh ) in a phonegap project, but
I am trying to set up FXLabel https://github.com/nicklockwood/FXLabel in my project but i get
I am trying to get Robolectric to work with the Android-release-archetype located https://github.com/akquinet/android-archetypes/wiki/Android-release-archetype I
I am trying to use the jquery globalization plugin (https://github.com/jquery/globalize) to work with asp.net
I'm trying to get https://github.com/tzuryby/jquery.hotkeys to work, but: $('#myInput').on({ 'keydown.space keydown.left keydown.right keydown.- keydown..'

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.