Jump to content

Recommended Posts

Hi PHP Experts, I'm a total newbie in PHP, I'm trying to modify this script, What I want is to display the result of what the user type in after they've clicked the submit button. Can somebody please tell me which script I need to change. Thanks

 

 

 

 

 

 

<?PHP

/* SUBJECT AND EMAIL VARIABLE */
$emailSubject = ' crazy php scripting '; 
$webMaster = 'ajame@gmail.com ';


/* gathering data variable */

$emailField = $_POST['email'] ;
$nameField = $_POST['name'] ;
$phoneField = $_POST['phone'] ;
$budgetField = $_POST['budget'] ;
$travelersField = $_POST['travelers'] ;
$commentsField = $_POST['comments'] ;
$newsletterField = $_POST['newsletter'] ;


$body = <<<EOD
<br><hr><br>
Email : $email <br>
Name : $name <br>
Phone : $phone <br>
Budget : $budget <br>
Number of Travelers : $travelers <br>
Comments : $comments <br>
Newsletter : $newsletter <br>
EOD;

$headers = "From : $email\r\n";
$headers .= "Content-type: text/html\r\n";
$success = mail($webMaster, $emailSubject, $body, $headers);

/*results rendered as html*/
$theResults = <<<EOD
<html>
<head>
<title>JakesWorks - travel made easy-Homepage</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body {
background-color: #f1f1f1;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
font-style: normal;
line-height: normal;
font-weight: normal;
color: #666666;
text-decoration: none;
}
-->
</style>
</head>

<div>
  <div align="left">Thank you for your interest! Your email will be answered very soon!</div>
</div>
</body>
</html>
EOD;
echo "$theResults";


?>

Link to comment
https://forums.phpfreaks.com/topic/241269-how-to-print-result-on-web-browser/
Share on other sites

See if this works for you:  *you can compare the two and see the 1 line that I changed.*

<?PHP

/* SUBJECT AND EMAIL VARIABLE */
$emailSubject = ' crazy php scripting '; 
$webMaster = 'ajame@gmail.com ';


/* gathering data variable */

$emailField = $_POST['email'] ;
$nameField = $_POST['name'] ;
$phoneField = $_POST['phone'] ;
$budgetField = $_POST['budget'] ;
$travelersField = $_POST['travelers'] ;
$commentsField = $_POST['comments'] ;
$newsletterField = $_POST['newsletter'] ;


$body = <<<EOD
<br><hr><br>
Email : $email <br>
Name : $name <br>
Phone : $phone <br>
Budget : $budget <br>
Number of Travelers : $travelers <br>
Comments : $comments <br>
Newsletter : $newsletter <br>
EOD;

$headers = "From : $email\r\n";
$headers .= "Content-type: text/html\r\n";
$success = mail($webMaster, $emailSubject, $body, $headers);

/*results rendered as html*/
$theResults = <<<EOD
<html>
<head>
<title>JakesWorks - travel made easy-Homepage</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body {
background-color: #f1f1f1;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
font-style: normal;
line-height: normal;
font-weight: normal;
color: #666666;
text-decoration: none;
}
-->
</style>
</head>

<div>
  <div align="left">Thank you for your interest! Your email will be answered very soon!</div>
  <div>You have entered the following: {$body} </div>
</div>
</body>
</html>
EOD;
echo $theResults;

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.