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 8460655
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T13:40:04+00:00 2026-06-10T13:40:04+00:00

I am attempting to email a form with radio button inside it, when I

  • 0

I am attempting to email a form with radio button inside it, when I go to send the email. I get a returned value of just “on”. I have set the name “value” correctly and tied it to form_validation code it all seems to “work” but the values are not being set correctly or emailed correctly. Code below.

Controller file:

public function contact_email()

{
        $this->load->helper(array('form', 'url'));
        $this->load->library('form_validation');
        $this->load->library('email');

        $this->form_validation->set_rules('name', 'Name', 'required|xss_clean');
        $this->form_validation->set_rules('email', 'Email', 'required|valid_email|xss_clean');
        $this->form_validation->set_rules('phone', 'Phone', 'is_numeric|xss_clean');
        $this->form_validation->set_rules('comments', 'Comments', 'xss_clean');

        if ($this->form_validation->run() == FALSE) {

            $data["messages"] = "";
            $this->load->view('engage_header');
            $this->load->view('engage_nav');
            $this->load->view('contact/content_form', $data);
            $this->load->view('engage_footer');

        } else {

            $data["messages"] = "The Email has successfully been sent";

            $this->email->from(set_value("email"), set_value("name"));
            $this->email->to('test@test.com');

             $this->email->subject('Contact Request');

            $message  = "Name: " . $this->input->post('name') . "\n";
            $message .= "Email: " . $this->input->post('email') . "\n";
            $message .= "phone: " . $this->input->post('phone') . "\n\n";
            $message .= "Comments: " . $this->input->post('comments') . "\n";
            $message .= "Favorite Drink:" . $this->input->post('drinks') . "\n";

            $this->email->message($message);  

            $this->email->send();

            echo $this->email->print_debugger();

            $this->load->view('engage_header');
            $this->load->view('engage_nav');
            $this->load->view('contact/content_form', $data);
            $this->load->view('engage_footer');
        }   
    }

View File

<div class="form_wrapper">
        <div class="head_left">
        <p class="heading"><img src="/resources/css/images/mail_icon.png" width="32px" height="32px" class="mail_icon">Contact Us</p>
        </div>
        <div class="borders"></div>

        <div class="form_container_left">

        <?php echo form_open('/index.php/site/contact_email')?>
        <label for="name">Your Name:</label>
        <input type="text" name="name" id="name" required/>
        <br/>
        <br/>
        <br/>
        <label for="email">Email:</label>
        <input type="text" name="email" id="email" required/>
        <br/>
        <br/>
        <br/>
        <label for="phone">Phone:</label>
        <input type="text" name="phone" id="phone"/>
        <br/>
        <br/>
        <br/>
        <label for="messages">How Can We Help?:</label>
        <textarea rows="" cols="" id="messages" name="comments"></textarea>
        <br/>
        <br/>
        <br/>
        <input type="reset" name="Reset" id="reset_bar">
        <input type="submit" name="Submit" id="submit_bar" value="Submit"> 


        </div>
        <div class="form_container_right">
            <p  class="optional_heading">Your Favorite Drink (optional):</p>
            <div class="soda_container">
            <img src="/resources/css/images/Soda.png" width="64px" height="64px">
            <center><p id="soda_text">Soda</p></center>
            <br/>
            <center><input type="radio" name="drinks" id="soda" value="soda"></center>
            </div>
            <div class="coffee_container">
            <img src="/resources/css/images/coffee.png" width="64px" height="64px">
            <center><p id="coffee_text">Coffee</p></center>
            <br/>
            <center><input type="radio" name="drinks" id="coffee" value="coffee"></center>
            </div>
            <div class="water_container">
            <img src="/resources/css/images/water.png" width="64px" height="64px">
            <center><p id="water_text">Water</p></center>
            <br/>
            <center><input type="radio" name="drinks" id="water" value="water"></center>
            </div>
            <div class="beer_container">
            <img src="/resources/css/images/beer.png" width="64px" height="64px">
            <center><p id="beer_text">Beer</p></center>
            <br/>
            <center><input type="radio" name="drinks" id="beer" value="beer"></center>
            </div>
            <div class="wine_container">
            <img src="/resources/css/images/wine.png" width="64px" height="64px">
            <center><p id="wine_text">Wine</p></center>
            <br/>
            <center><input type="radio" name="drinks" id="wine" value="wine"></center>
            </div>
        </div>  
        <?php echo form_close()?>
  • 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-10T13:40:06+00:00Added an answer on June 10, 2026 at 1:40 pm

    In order to email radio button values they first must be set by declaring set_radio nested in the value parameter. Like so

    <input type="radio" name="drinks" id="water" value="water" <?=set_radio('drinks','water') ?>>
    

    There are numerous ways to recall this information back to your “controller” I just used a simple $this->input->post('$variable') worked.

    This is how I called it into a message and is what worked for me.

        $message  = "Name: " . $this->input->post('name') . "\n";
        $message .= "Email: " . $this->input->post('email') . "\n";
        $message .= "Phone: " . $this->input->post('phone') . "\n\n";
        $message .= "Favorite Drink: " . $this->input->post('drinks') . "\n";
        $message .= "Comments: " . $this->input->post('comments') . "\n";
    

    The name “value” set in your view must correlate with the value passed in the controllers $this->input->post('') parameter.

    Thanks for everyone’s help on this!!
    Dyllen

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

Sidebar

Related Questions

Attempting to get Spring internationalization working. I have used classpath:messages basename, created .properties files
Attempting/struggling to get registration and sign-up working within an active admin project. I have
I'm attempting to use 'jQuery Validate' on a form that requires an email address
Alright here is what I am attempting to do. I have a form written
I am attempting to validate a form that contains fields with name attributes containing
I have an Email object and am attempting to validate the number of attachments
I am attempting to grab just the email address from a string of text
I am attempting to get the body of an email message using message.get_payload(). However,
Im attempting to get my contact form to redirect to the homepage after form
I am attempting to send an email using VB.NET. There are two requirements: The

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.