Jump to content

Help! php not showing $xxxx info in email


mrebeler87

Recommended Posts

I receive the email just fine but when I do I don't get any info. What am I missing?

<?php
$email = $_POST['email'];
$first = $_POST['first'];
$last = $_POST['last'];
$business = $_POST['business'];
$home = $_POST['home'];
$cell = $_POST['cell'];
$other = $_POST['other'];
$street = $_POST['street'];
$city = $_POST['city'];
$state = $_POST['state'];
$zip = $_POST['zip'];
$con_time = $_POST['con_time'];
$cameras = $_POST['cameras'];
$quality = $_POST['quality'];
$monitor = $_POST['monitor1'];
$monitor = $_POST['monitor2'];
$monitor = $_POST['monitor3'];
$monitor = $_POST['monitor4'];
$monitor = $_POST['monitor5'];

$to = 'sales@landb-securities.com';
$subject = ' Sales Request ' ;
$message = " 

Conact Name:
Name:		$first $last
Business Name:	$business

Conact Numbers:
Home:	$home
Cell:	$cell
Other:	$other
	Preferred Contact time: $con_time

Address:
Street Address:	$street
City:		$city
State:		$state
Zipcode:	$zip

The customer is interested in $cameras at $quality and wants to monitor it via $monitor1,$monitor2,$monitor3,$monitor4,$monitor5. \r\n";

$headers = 'From: ' .$email . "\r\n" .
    'Reply-To: '  .$email . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $message, $headers);

echo "Thank You, Your request has been sent.<br> <br>";
echo "<a href=\"http://landb-securities.com\"> Back to Home Page </a>";

?> 
Link to comment
Share on other sites

replace this for your $message

       $message =  <<<MAILBODY
Name: {$first $last}
Business Name: {$business}
 
Conact Numbers:
Home: {$home}
Cell: {$cell}
Other: {$other}
Preferred Contact time: {$con_time}
 
Address:
Street Address: {$street}
City: {$city}
State: {$state}
Zipcode: {$zip}
    
MAILBODY;
Link to comment
Share on other sites

@hakim, please don't provide wrong or useless solutions! Here isn'a a children's place. It's a help forum.

Also, check at docs where and how you can use curly braces in the scripts. 

if you dont know ask you are ashaming the guru tag. check the code if it gives any error report the error. by the way what was your solution to the problem? you could not even see that the guy's $message was not set.

 

by the way those {} are called inline substitution. call it a day you lernt something new.

Edited by hakimserwa
Link to comment
Share on other sites

if you dont know ask you are ashaming the guru tag.

Nobody asked me whether I wanna be a guru at phpfreaks.com.It was just a guru(mod) community decision.It does not matter for me to be or not a guru at all. I just wanna provide my help.

 

it gives any error report the error. by the way what was your solution to the problem?

Yes, he could put the error_reporting() function on the top of the page, but var_dump() is a good solution too.

 

 

you could not even see that the guy's $message was not set.

 

No, the message has been sent with empty values!

 

by the way those {} are called inline substitution. call it a day you lernt something new.

It's not really necessary to use curly braces or heredoc here, but if you want it, you should aware that all braces expansion are performed before any other expansions, and any characters special to other expansions are preserved in the result. That's why, you cannot have more then one variable, like { $var1 $var2 } outside of a function or just for "for", "while", "foreach" looping constructs.

If you're using some IDE, you will get a syntax error! 

Edited by jazzman1
Link to comment
Share on other sites

I see the $message in the OP, changing a double quoted string to a heredoc is not really a help in this situation IMHO (unless I am totally missing something).  I would go back to Jazzman's post and say var_dump the incoming $_POST to make sure you have the index names right.

Link to comment
Share on other sites

Hey guys thanks so much for replying. Long story short but I forgot to name all my inputs and I forgot to give value to my radios *facepalm* its sends just fine now but I will add in var dump to verify value as well. Thanks again guys/gals.. yall have a good one

Link to comment
Share on other sites

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.