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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T20:05:31+00:00 2026-05-30T20:05:31+00:00

I am unsure as too why I am getting the following errors when trying

  • 0

I am unsure as too why I am getting the following errors when trying to pass data through to my html email template -> The PHP errors are coming from the view.

Undefined variable: companyName -> line 9

Undefined variable: firstName -> line 12

Controller:

function _userRegEmail($activateCode,$email,$firstname,$lastname){
        $data['companyName'] = $this->core_model->companyDetails()->coreCompanyName;
        $data['companyEmail'] = $this->core_model->companyDetails()->coreContactEmail;
        $data['companyContact'] = $this->core_model->companyDetails()->coreContactName;
        $data['firstName'] = $firstname;
        $data['lastName'] = $lastname;
        $data['email'] = $email;
        $data['activateCode'] = $activateCode;

        $this->email->from($this->core_model->companyDetails()->coreContactEmail, $this->core_model->companyDetails()->coreCompanyName);
        $this->email->to($email);
        $this->email->subject($this->core_model->companyDetails()->coreCompanyName 'User Registration Confirmation');

        $messageContent= $this->load->view('email_templates/userReg','', TRUE);

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

        $this->email->send();

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

View:

<html>
  <head>
    <meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
    <title/>
  </head>
  <body>
    <div class="container" style="width: 600px;height: 100%;margin: 0 auto;font-family: Arial, &quot;MS Trebuchet&quot;, sans-serif">
        <div class="header" style="width: 100%">
            <h1 style="text-align: center;color: #00afd8"><?php echo $companyName; ?></h1>
            </div>
                <div class="content">
                    <h2 style="font-size: 15px">Hello <?php echo $firstName; ?></h2>
                <p style="margin-left: 15px">Thank you for signing up to Farm Ads.</p>
                <p style="margin-left: 15px">Could you please click <a href="<?php base_url(); ?>users/confirm/"<?php $activateCode; ?>>here</a> to activate your account.</p>

                <div class="from">
                    <p class="bold" style="margin-left: 15px;font-weight: bold;font-size: 12px">Regards,</p>
                    <p style="margin-left: 15px;font-weight: bold;font-size: 12px"><?php $companyContact; ?></p>
                    </div>
             </div> 
        </div>

</body>
</html>
  • 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-05-30T20:05:32+00:00Added an answer on May 30, 2026 at 8:05 pm

    If you want to use the variables you have set in $data in the view you shouldn’t do:

    $messageContent= $this->load->view('email_templates/userReg','', TRUE);
    

    But:

    $messageContent= $this->load->view('email_templates/userReg', $data, TRUE);
    

    This makes sure you send the variables to the view so they can be used in there like you are trying already.

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

Sidebar

Related Questions

In my void union function I am unsure how to insert the data from
There is a relatively simple thing I'm trying to achieve but I'm unsure how
I'm getting an OutOfMemory Exception when trying to resize larger images. Our server can
I'm in the process of trying to make a secure PHP based login system
Unsure how to get this string to work correctly. Keeps making my page blank.
Unsure about static variables. import java.io.File; public class Logger { public static final File
I am unsure why this code will not work. When I click a button
I'm unsure on the best stack to build a chat application. Currently I'm thinking
I am unsure why is this rsync command is not syncing? rsync -v -e
I'm unsure how to do this. One way is: import urllib.request; urllib.request.urlretrieve('www.example.com/file.tar', 'file.tar') Another

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.