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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T14:42:20+00:00 2026-05-30T14:42:20+00:00

I am modifying a registration form to include two radio buttons for the account

  • 0

I am modifying a registration form to include two radio buttons for the account type the customer is applying for.
So I have two new buttons: Personal Account [] Corporate Account [].

If the customer selects personal account, value “1” is saved to a new column in my customer table (account_type), and if corporate account is selected, the value “0” is saved.
Now, what I want to do is to modify the code below that sends an email to admin every time a new customer registers so that it sends an extra email if a customer has applied for a Corporate account.

$mail = new Mail();
$mail->protocol = $this->config->get('config_mail_protocol');
$mail->parameter = $this->config->get('config_mail_parameter');
$mail->hostname = $this->config->get('config_smtp_host');
$mail->username = $this->config->get('config_smtp_username');
$mail->password = $this->config->get('config_smtp_password');
$mail->port = $this->config->get('config_smtp_port');
$mail->timeout = $this->config->get('config_smtp_timeout');
$mail->setTo($data['email']);
$mail->setFrom($this->config->get('config_email'));
$mail->setSender($this->config->get('config_name'));
$mail->setSubject($subject);
$mail->setText($message);
$mail->send();

**// Send to main admin email if new account email is enabled**
if ($this->config->get('config_account_mail')) {
    $mail->setTo($this->config->get('config_email'));
    $mail->send();
    // Send to additional alert emails if new account email is enabled
    $emails = explode(',', $this->config->get('config_alert_emails'));
    foreach ($emails as $email) {
        if (strlen($email) > 0 && preg_match('/^[^\@]+@.*\.[a-z]{2,6}$/i', $email)) {
            $mail->setTo($email);
            $mail->send();
        }
    }
}

The code above after “//send to main admin if new account email is enabled” just sends a simple email to admin saying someone new has registered. I want to keep that, but I would like to send the extra email if someone is applying for a corporate account. I guess I just need to use an if statement to check whether account_type=0 but I am not an expert and I don’t know how to integrate that to the existing code. I hope I have explained myself well. By the way, all this code is from Open Cart, open-source e commerce system.

  • 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-30T14:42:21+00:00Added an answer on May 30, 2026 at 2:42 pm

    you can use if condition like

    if(isset($_POST['ur_radio_ele_name']) && $_POST['ur_radio_ele_name']!=''){
      // your code to send mail
    }
    

    if $_POST['ur_radio_ele_name'] is set and not null then only it would send mail, otherwise it wont.

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

Sidebar

Related Questions

I have two threads modifying the same object, lets say MyObject, and so have
Modifying a SnapPages theme, meaning I only have access to the CSS stylesheet. I
I am modifying my PHP network's code to have user roles like wordpress here
I am modifying a wordpress theme completely, and have run into one very simple
Modifying to make it clear: I have a question on exception logging and graceful
Modifying working form with one spot per order to multiple spots per order I
When modifying code I find I often have to go through dozens of files
I am modifying a Nant build script to run some unit tests. I have
Im modifying a theme in wordpress and would like to have the possibility to
I have been modifying my containers to be STL compatible. I have modified my

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.