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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T05:29:01+00:00 2026-05-13T05:29:01+00:00

Im not a pro at PHP, just starting actually and was wondering if you

  • 0

Im not a pro at PHP, just starting actually and was wondering if you could help me.

Im trying to get this contact form to email me stating the Persons Name and the message like this.

Name: Fred Blogs
Message: Message, Message.

But when I try all I get is the message, I cant seem to insert the name variable anywhere.

This is the code

<?php 
$name = $_REQUEST['name'] ;
$email = $_REQUEST['email'] ;
$message = $_REQUEST['message'] ;
$subject = $_REQUEST['subject'] ;

mail( "keiron.lowe@example.com", "Name: $name", "$subject", $message, "From: $email" );
header( "Location:contact.php" );
?>
  • 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-13T05:29:02+00:00Added an answer on May 13, 2026 at 5:29 am

    You are passing too many parameters to the mail() function. Try something like this:

    <?php 
    ob_start();
    $name = $_POST['name'] ;
    $email = filter_input(INPUT_POST, 'email', FILTER_SANITIZE_EMAIL);
    $message = $_POST['message'] ;
    $subject = strtr($_POST['subject'],array(':' => ' ', "\r" => ' ', "\n" => ' '));
    
    $message = "Name: {$name}\r\nmessage: {$message}";
    mail("redacted@example.com", $subject, $message, "From: {$email}");
    header("Location: contact.php", true, 302);
    ob_end_clean();
    die;
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm not a pro in Regex, therefore I'm having a difficulty translating this regex
Not exactly about programming, but I need help with this. I'm running a development
I followed this instruction but not worked for me. I just wanna install and
So I have an issue with some PHP code, and I'm not a pro
I'd prefer a commercial solution. So not NHibernate. Now i'm playing with LLBLGen pro
Not sure if this counts as programming related, it's a tool that I use.
Not that level of failure indeed. I just completed the 4 part tutorial from
Not entirely sure of a good title for this, feel free to edit it
Not that it matters strictly, and maybe I just don't yet fully understand how
Not sure exactly what I need to do to make this work, so 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.