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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T07:59:52+00:00 2026-06-16T07:59:52+00:00

I have a simple email form in a php file and i try to

  • 0

I have a simple email form in a php file and i try to send emails but it seems that my variables come null. I have an echo after my code just to test if my variables have any values inside and they are not printed. The only thing that is printed is the ‘done’ and the ’email $to’. Do i do anything wrong? I followed this method from a post in youtube and he did the exact same thing and it worked for him. I also tried more email php files but still nothing.
Here is my html and php code.

php code:

 <?php 

$name = $_REQUEST['author'];
$from = $_REQUEST['email'];
$subj = $_REQUEST['sub'];
$message = $_REQUEST['msg'];

$headers .= "From: ".$from;

$to = "mygmail@gmail.com";

$subject = $subj;
$body = $message;

if(mail($to,$subject,$body,$headers)) {
echo "An e-mail was sent to ".$to." with the subject: ".$subject;
} else {
echo "There was a problem sending the mail. Check your code and make sure that the e-mail address ".$to." is valid";
}

?>

html code:

<form action="formtoemail.php" method="post" enctype="text/plain">
                            <p>
                                <label for="author">Name:</label> 
                                <input type="text" id="author" name="author" class="required input_field" />
                            </p>
                            <p>
                                <label for="email">Email:</label> 
                                <input type="text" id="email" name="email" class="validate-email required input_field" />
                            </p>
                            <p class="no_margin_right">
                                <label for="subject">Subject:</label> 
                                <input type="text" name="sub" id="sub" class="input_field" />
                            </p>
                            <div class="cleaner h20"></div>

                            <label for="text">Message:</label> 
                            <textarea id="msg" name="msg" rows="0" cols="0" class="required"></textarea>
                            <div class="cleaner h20"></div>

                            <input type="submit" value="Send" id="submit" name="submit" class="submit_btn float_l" />
                            <input type="reset" value="Reset" id="reset" name="reset" class="submit_btn float_r" />
                      </form>
  • 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-16T07:59:53+00:00Added an answer on June 16, 2026 at 7:59 am

    You are sending via POST and retriving via GET try $_POST instead of $_GET in PHP

    OR in HTML –

    Chenge from action to GET instead of POST

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

Sidebar

Related Questions

Let's say that I have a file (file1.php) with a simple form with the
i have a simple contact us form and i need to send an email
i have downloaded Swift Mailer from their website and try to send simple email
I have a simple php script on my domain that sends me an email:
I have a very simple workflow that is just trying to send an email
I have a page called send.email.php which sends an email - pretty simple stuff
I have a page called send.email.php which sends an email - pretty simple stuff
I have a couple of simple forms that send an html-only email. Most clients
I have an HTML form that uses a PHP file in the form tag
I have a simple email form: <form method=post action=process-form.php id=emailForm name=emailForm target=_self> <h4>Sign up

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.