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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T21:37:08+00:00 2026-06-12T21:37:08+00:00

I’m new to PHP so bear with me. My form is sending empty emails

  • 0

I’m new to PHP so bear with me. My form is sending empty emails when I press submit. Any help would be great.

This is my form:

    <form class="contact_form" action="kontakt.php" method="post">
        <p><input type="text" required="required" id="name" name="name" class="text_input" value="" size="22"  />
        <label for="name">Namn *</label></p>

        <p><input type="text" required="required" id="company" name="company" class="text_input" value="" size="22"  />
        <label for="company">Företag *</label></p>

        <p><input type="email" required="required" id="email" name="email" class="text_input" value="" size="22"  />
        <label for="email">Epost *</label></p>

        <p><textarea required="required" name="content" class="textarea" cols="30" rows="5"></textarea></p>

        <p><button type="submit" class="button white"><span>Skicka</span></button></p>
        <input type="hidden" value="info@web.se" name="contact_to"/>
    </form>

And my PHP code so far is:

<?php

$name = $_POST['name'];
$company = $_POST['company'];
$email = filter_input(INPUT_POST, 'email', FILTER_VALIDATE_EMAIL);
$content = $_POST['content'];



$mail_to = 'info@web.se';

$subject = 'Lilla form'.$name;



$body_message = 'From: '.$name."\n";

$body_message .= 'E-mail: '.$email."\n";

$body_message .= 'Message: '.$content;



$headers = 'From: '.$email."\r\n";

$headers .= 'Reply-To: '.$email."\r\n";



$mail_status = mail($mail_to, $subject, $body_message, $headers);

?>

Please help me, I’m really stuck.

Thank you all!

  • 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-12T21:37:09+00:00Added an answer on June 12, 2026 at 9:37 pm

    Try this

     <form class="contact_form" action="kontakt.php" method="post">
        <p><input type="text" required="required" id="name" name="name" class="text_input" size="22"  />
        <label for="name">Namn *</label></p>
    
        <p><input type="text" required="required" id="company" name="company" class="text_input" size="22"  />
        <label for="company">Företag *</label></p>
    
        <p><input type="email" required="required" id="email" name="email" class="text_input"  size="22"  />
        <label for="email">Epost *</label></p>
    
        <p><textarea required="required" name="content" class="textarea" cols="30" rows="5"></textarea></p>
    
        <p><button type="submit" class="button white"><span>Skicka</span></button></p>
        <input type="hidden" value="info@web.se" name="contact_to"/>
    </form>
    

    Edit:(Debug)

    $name = $_POST['name'];
    $company = $_POST['company'];
    $email = filter_input(INPUT_POST, 'email', FILTER_VALIDATE_EMAIL);
    $content = $_POST['content'];
    
    echo $name.$comapny.$email.$content;exit; // check whether the values are posted successfully or not
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Fairly new to classes in PHP, so bear with me. class processRoutes { //Next
This is a bit complicated so bear with me: On FORM.php, I have 2
I'm incredibly new to php so please bear with me and help me learn.
I am fairly new to PHP so please bear with me :) What I
I am trying to use a PHP form (new.php) to update 2 MySQL tables
New to PHP and MySQL, have heard amazing things about this website from Leo
Rather new to php, so sorry if this seems stupid. I'm really copying a
I have a PHP form which posts any number of records for the following:
HI Guys, Im kinda new to php and xml so pls bear with me.
This is kind of hard to explain, so bear with me. In PHP, if

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.