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

  • Home
  • SEARCH
  • 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 8834137
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T08:56:41+00:00 2026-06-14T08:56:41+00:00

I have developed a contact form which incorporates CI form validation, email helper and

  • 0

I have developed a contact form which incorporates CI form validation, email helper and class. When the user sends the information the client will receive a HTML email with this information. I have already created a separate view with the HTML table structure and this is built through a string in the controller [code below]. Is there any way of passing what the user has sent into this HTML form? For example in my email I have:

-You have received an email from $name<br>
-Message $message<br>
-You can reply to them at $email

It would be great if someone could guide me. I have included important snippets of code as a guide.

View:

<h1>Contact</h1>
<div id="contact">
<?php

    echo $message;
    echo validation_errors();

    echo form_open('contact/send_email');

    //Name field
    echo form_label('Name: ', 'name');
        $data = array (
            'name' => 'name',
            'id' => 'name',
            'value' => set_value('name')
        );
    echo form_input($data);

    echo form_submit('submit', 'Send');

    echo form_close();

Controller:

At the top of this code is the form validation and if else statements, and this is what happens when it has passed validation checks:

}else{
    $data['message'] = 'The email has successfully been sent';

    $html_email = $this->load->view('html_email', $data, true);

    //load the email class
    $this->load->library('email');

    $this->email->from(set_value('email'), set_value('name'));
    $this->email->to('email@hotmail.com');
    $this->email->subject('Message from Website');
    $this->email->message($html_email);

    $this->email->send();

    //if error from library will send us metadata
    echo $this->email->print_debugger();

    $data['page_title'] = 'Contact';
    $data['content'] = 'contact';   
    $this->load->view('template', $data);
}
  • 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-14T08:56:42+00:00Added an answer on June 14, 2026 at 8:56 am

    Doing things the CodeIgniter way you should use $this->input->post('name') instead of $_POST['name']

    To get the data to your view just add

    $data['name'] = $this->input->post('name');

    Before you load your view. This will allow you to print the $name variable in the view as in your initial statement. I.e. in the view:

    You have a message from <?=$name?>

    In the controller I would also change set_value('name') for $this->input->post('name').

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have developed a simple php contact form, that's working fine, but i am
I have developed a small C# form application which calls a web service. Everything
I have developed a web site that requires user registration and authentication for some
I have developed a small administration page for game servers which you can add/remove/edit
i have developed an app which executes sql jobs. When I click on execute
We have developed a messaging application in j2me which adds text message, gets pictures
I have a simple contact form that works in every browser, except IE. It
I have come across a dynamically written form which I would like to style
I have developed one code to edit contact but it is not working in
I have developed an android app that sends sms. My problem is that when

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.