/    Sign up×
Community /Pin to ProfileBookmark

Using phpMailer to Send Visitor Data from Web Form to Mail through PHP

Hi

I am having issues with my phpmailer script, I am receiving the email but i am not receiving the visitor data inputed on the site, the body of the email is empty. Here is my phpmailer script and errorlog i got from the sever.

[B]PHPMAILER SCRIPT[/B]

[code=php]<?php

$Transaction_Type = $_REQUEST[‘Transaction_Type’] ;
$eCurrency_Type = $_REQUEST[‘eCurrency_Type’] ;
$Amount_USD = $_REQUEST[‘AmountinUSD’] ;
$Account_ID = $_REQUEST[‘Account_ID’] ;
$Confirm_ID = $_REQUEST[‘Confirm_ID’] ;
$Account_Name = $_REQUEST[‘Account_Name’] ;
$Phone_Number = $_REQUEST[‘Phone_Number’] ;
$Email_address = $_REQUEST[‘Email_address’] ;

require(“/home/jofexcha/public_html/phpmailertesting/PHPMailer_5.2.0/class.phpmailer.php”);

$mail = new PHPMailer();

$mail->IsSMTP(); // set mailer to use SMTP
$mail->Host = “localhost”; // specify main and backup server
$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->Username = “[email protected]”; // SMTP username
$mail->Password = “juicy”; // SMTP password

$mail->From = “[email protected]”;
$mail->FromName = “JOe”;
$mail->AddAddress(“[email protected]”); // name is optional

$mail->WordWrap = 50; // set word wrap to 50 characters
$mail->IsHTML(true); // set email format to HTML

$mail->Subject = “Withdrawal Instructions”;
$mail->Body = ” “;

$mail->AltBody = “This is the body in plain text for non-HTML mail clients”;

if(!$mail->Send())

echo ‘Transaction_Type: ‘ . $Transaction_Type . ‘<br>’;

echo ‘eCurrency_Type: ‘ . $eCurrency_Type;

echo ‘Amount_USD: ‘ . $Amount_USD;

echo ‘Account_ID: ‘ . $Account_ID;

echo ‘Confirm_ID: ‘ . $Confirm_ID;

echo ‘Account_Name: ‘ . $Account_Name;

echo ‘Phone_Number: ‘ . $Phone_Number;

echo ‘Email_address: ‘ . $Email_address;

header(‘Location:https://www.jofexchange.com/success.html’);

?>

[/code]

[B]ERROR LOGS[/B]

[code=html]

[04-Mar-2017 01:46:00 America/New_York] PHP Notice: Undefined index: Transaction_Type in /home/jofexcha/public_html/phpmailertesting/testing.php on line 3

[04-Mar-2017 01:46:00 America/New_York] PHP Notice: Undefined index: eCurrency_Type in /home/jofexcha/public_html/phpmailertesting/testing.php on line 4

[04-Mar-2017 01:46:00 America/New_York] PHP Notice: Undefined index: AmountinUSD in /home/jofexcha/public_html/phpmailertesting/testing.php on line 5

[04-Mar-2017 01:46:00 America/New_York] PHP Notice: Undefined index: Account_ID in /home/jofexcha/public_html/phpmailertesting/testing.php on line 6

[04-Mar-2017 01:46:00 America/New_York] PHP Notice: Undefined index: Confirm_ID in /home/jofexcha/public_html/phpmailertesting/testing.php on line 7

[04-Mar-2017 01:46:00 America/New_York] PHP Notice: Undefined index: Account_Name in /home/jofexcha/public_html/phpmailertesting/testing.php on line 8

[04-Mar-2017 01:46:00 America/New_York] PHP Notice: Undefined index: Phone_Number in /home/jofexcha/public_html/phpmailertesting/testing.php on line 9

[04-Mar-2017 01:46:00 America/New_York] PHP Notice: Undefined index: Email_address in /home/jofexcha/public_html/phpmailertesting/testing.php on line 10[/code]

[B]

PLEASE WHAT IS THE RIGHT CODES TO USE IN OTHER TO GET THE DATA OF THE VISITOR SENT TO MY EMAIL. [/B]

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@ginerjmMar 04.2017 — Stop using $_REQUEST. Use the appropriate method instead.

Turn on error checking in your script to make it easier to see the errors as you develop the script.

The errors all indicate that you don't have those fields in your input. Where is this input coming from - you don't show us that. When this script begins it immediately looks for input. How do we know that there is actually input?
Copy linkTweet thisAlerts:
@NogDogMar 04.2017 — Stick this at the top of that script to see what you're really getting (if anything), and remember that the form field names and those request array keys must match exactly, including case:
[code=php]
<?php
echo '<pre>'.print_r($_REQUEST, 1).'</pre>';
[/code]
×

Success!

Help @ebijo spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...