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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T08:12:47+00:00 2026-06-18T08:12:47+00:00

Here i have a code like getting the data from index.php , if user

  • 0

Here i have a code like getting the data from index.php , if user enter the data it will show like table and as well as it should go to email to some predefined mail. But here i am getting data Dynamically , i tried with $_REQUEST and $_POST both methods to get the data , but in mail function i am trying to change message parameter but by php tags its is not taking and showing some syntax errors.

please go through code here

<?php
$to="xxxxxxx@gmail.com";
$fn="Fisrt Name";
$ln="Last Name";
$name=$fn.' '.$ln;
$from="xxxxx@xxx.com";
$subject = "Welcome to Website";

include('newsmtp/smtpwork.php');

 ?>
 <?php

 $message = 'Dear $firstName, 


 Your Welcome Message.'.'
 <table border=1>

    <tr>
        <td>First Name:</td>
        <td><?php $firstName=$_POST['firstname'];
        echo $firstName;?></td>
    </tr>

    <tr>
        <td>Last Name:</td>
        <td><?php $lastname=$_POST['lastname'];
        echo $lastname;?></td>

    </tr>

    <tr>

        <td>Title:</td>
        <td><?php $title=$_POST['title'];
        echo $title;?></td>
    </tr>

    <tr>

        <td>Address:</td>
        <td><?php $address=$_POST['address'];
        echo $address;?></td>
    </tr>

    <tr>

        <td>Phone Number:</td>
        <td><?php $phone=$_POST['phone'];
        echo $phone;?></td>
    </tr>


    <tr>

        <td>Course Name:</td>
        <td><?php $course=$_POST['coursename'];
        echo $course;?></td>

    </tr>

    <tr>

        <td>Website:</td>
        <td><?php $website=$_POST['website'];
        echo $website;?></td>

    </tr>

</table>

Thanks
xxxxxxxxxxxx
';
?> 
  • 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-18T08:12:48+00:00Added an answer on June 18, 2026 at 8:12 am

    Try this method, assign the posted values in variables, outside the $message variable and print the variable inside your $message variable

    $firstname  = $_POST['firstname'];
    $lastname   = $_POST['lastname'];
    $title      = $_POST['title'];
    $address    = $_POST['address'];
    $phone      = $_POST['phone'];
    $course     = $_POST['course'];
    $website    = $_POST['website'];
    
    
        $message = 'Dear '.$firstName.', 
         Your Welcome Message.'.'
         <table border=1>
            <tr>
                <td>First Name:</td>
                <td>'.$firstname.' </td>
            </tr>
            <tr>
                <td>Last Name:</td>
                <td>'.$lastname.'</td>
            </tr>
         <tr>
            <td>Title:</td>
            <td>'.$title.'</td>
        </tr>
        <tr>
            <td>Address:</td>
            <td>'.$address.'</td>
        </tr>
        <tr>
            <td>Phone Number:</td>
            <td>'.$phone.'</td>
        </tr>
        <tr>
            <td>Course Name:</td>
            <td>'.$course.'</td>
        </tr>
        <tr>
            <td>Website:</td>
            <td>'.$website.'</td>
        </tr>
    </table>
    Thanks
    xxxxxxxxxxxx
    ';
    ?> 
    
    
    
    
    $to       ="xxxxxxx@gmail.com";
    $subject  = "Welcome to Website";
    $headers  = 'From: xxxxxx <noreply@xxxxxxx.com>' . "\r\n";
    $headers .= "MIME-Version: 1.0\r\n";
    $headers .= "Content-Type: text/html;\n\tcharset=\"iso-8859-1\"\r\n";
    
    $sent   = @mail($to,$subject,$message,$headers); 
    
            if ($sent) {
                return true;
            } else {
                return false;
            }
    

    Also add necessary header to send HTML mail as Vinoth Babu, Naveen suggested

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

Sidebar

Related Questions

I am modifying my PHP network's code to have user roles like wordpress here
So I have some PHP code that looks like: $message = 'Here is the
I am working on reading data from excel sheet. My table will look like
i have implemented code like here but it's not working for iOS 5.0, it
here is what my code looks like i have two forms: class Form_1 extends
Basic question here - I have many lines of code that look something like:
I have strings like follow field_zip_code:48103 taxonomy:88 field_zip_code:48103 taxonomy:88 field_state:MI field_zip_code:48103 From here i
Here I have piece of code, showing example of how I want to update
I am using the sample provided here and have used the code inside a
Here is my issue. I have an ASPX web site and I have code

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.