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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T04:53:13+00:00 2026-05-14T04:53:13+00:00

i have bought a template that have built in contact form problem is that

  • 0

i have bought a template that have built in contact form
problem is that it submits every thing except “company” name
i messed around with it but cant get to work it.
if you can point me to some solution i would be greatful

thanks in advance

this is php script

if(!$_POST) exit;

$email = $_POST['email'];


//$error[] = preg_match('/\b[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b/i', $_POST['email']) ? '' : 'INVALID EMAIL ADDRESS';
if(!eregi("^[a-z0-9]+([_\\.-][a-z0-9]+)*" ."@"."([a-z0-9]+([\.-][a-z0-9]+)*)+"."\\.[a-z]{2,}"."$",$email )){
    $error.="Invalid email address entered";
    $errors=1;
}
if($errors==1) echo $error;
else{
    $values = array ('name','email','message');
    $required = array('name','email','message');

    $your_email = "--------@gmail.com";
    $email_subject = "New Message: ".$_POST['subject'];
    $email_content = "new message:\n";

    foreach($values as $key => $value){
      if(in_array($value,$required)){
        if ($key != 'subject' && $key != 'company') {
          if( empty($_POST[$value]) ) { echo 'Please fill in all required fields, marked with *'; exit; }
        }
        $email_content .= $value.': '.$_POST[$value]."\n";
      }
    }

    if(@mail($your_email,$email_subject,$email_content)) {
        echo 'Thanks for your message, will contact you soon.'; 
    } else {
        echo 'ERROR!';
    }
}
  • 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-14T04:53:13+00:00Added an answer on May 14, 2026 at 4:53 am
    $values = array ('name','email','message');
    

    Add 'company' to this list in the PHP script.

    Also, I would modify the foreach loop to look like this, to get the intended functionality:

    foreach($values as $key => $value)
    {
        if(in_array($value,$required))
        {
            if(empty($_POST[$value]))
            {
                    echo 'Please fill in all required fields, marked with *';
                    exit;
            }
        }
        $email_content .= $value.': '.$_POST[$value]."\n";
    }
    

    This way, fields that aren’t in the $required array are still added to the email if they exist – they just don’t have to pass the empty check.

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

Sidebar

Related Questions

I have recently bought a template that came with a flash header. I want
We recently bought two new build machines that have the same specs/hardware. From what
I have bought a Joomla template from Template monster. It looks like this template
I have bought a 7'' pad from a chineese supplier, claiming that it is
I have two tables, one stores the products and quantity we have bought, the
I have good knowledge on C++ (not C) and recently bought a Symbian-based phone.
I have a neural network written in Erlang, and I just bought a GeForce
We have a Java application that needs to be brought to the foreground when
Have just started using Visual Studio Professional's built-in unit testing features, which as I
I recently bought a new web server 2008 for our company and require a

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.