masnobi Posted April 15, 2013 Share Posted April 15, 2013 Hi all, I want to echo two variables inside the body of automatic email. i am trying to get those two variables from the form that customer just submitted. i am posting my code below, please help ASAP. Thanks in advance <?php if(isset($_POST['button_pressed'])) { $to=$Email; $subject='Hi There!!'; $body='Hi'; $Title . '' . $Surname; ', This is a demo email sent using PHP on XAMPP'; if (mail($to,$subject,$body)){ echo 'Mail sent successfully!'; } else{ echo 'Mail not sent!'; }} ?> Quote Link to comment Share on other sites More sharing options...
Solution DavidAM Posted April 15, 2013 Solution Share Posted April 15, 2013 $body='Hi'; $Title . '' . $Surname; ', This is a demo email sent using PHP on XAMPP'; That first semi-colon (after "Hi") should be a . (dot), for concatenation. Quote Link to comment Share on other sites More sharing options...
masnobi Posted April 15, 2013 Author Share Posted April 15, 2013 Thanks a lot dude, you are a star Quote Link to comment Share on other sites More sharing options...
m4anm4 Posted May 23, 2015 Share Posted May 23, 2015 Hello to everyone, is too late to ask you all a suggestion about this topic? I need an help to generate an automatic answer to an email once completed the form, I have wrote only this little part <form action="source_example1.php" method="post"> <label>Name: <input type="text" name="name" /> </label><br /> <label>Surname: <input type="text" name="surname" /> </label><br /> <input type="submit" value="Go" /> </form> <?php $firstname = $_POST ['name']; $lastname = $_POST ['surname']; echo "Thanks mate, $firstname $lastname!"; ?> Now, how send an email to me or someone else with that echo answer? Thanking you all Regards Quote Link to comment Share on other sites More sharing options...
m4anm4 Posted May 23, 2015 Share Posted May 23, 2015 This is the original working robot <form action="sorgente_esempio1.php" method="post"> <label>Nome: <input type="text" name="nome" /> </label><br /> <label>Cognome: <input type="text" name="cognome" /> </label><br /> <input type="submit" value="Vai" /> </form> <?php $firstname = $_POST ['nome']; $lastname = $_POST ['cognome']; echo "Thanks mate, $firstname $lastname!"; ?> Please help! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.