timgetback Posted August 2, 2006 Share Posted August 2, 2006 I want to send html variables that are using the post method via php mail to an account........ here is my mail.php file:<?$to = "mail@mailer.com";$subject = "Email Info";$info1 = $_POST['name']$info2 = $_POST['age']$body = "$info1 , $info2";if (mail($to, $subject, $body)) { echo("<p>message successfully sent!</p>"); } else { echo("<p>Error Try again...</p>"); }?> Ok... i used action= mail.php however it doesnt show whether or not the message was sent or not... allso the account is not recieving the message if anyone can deliever a straight forward answer it would be great. Quote Link to comment Share on other sites More sharing options...
bpops Posted August 2, 2006 Share Posted August 2, 2006 If you're not seeing anything, my first suggestion would be to change <? to <?phpThe former is not supported by all installations (or servers) with php. I've seen people on these forums before with this problem.also, with your form, you are doing method="post" and not method="get" right? Quote Link to comment Share on other sites More sharing options...
king arthur Posted August 2, 2006 Share Posted August 2, 2006 [quote author=timgetback link=topic=102757.msg408306#msg408306 date=1154544225]Ok... i used action= mail.php [/quote]action = mail.php or action="mail.php"? Quote Link to comment Share on other sites More sharing options...
timgetback Posted August 2, 2006 Author Share Posted August 2, 2006 its method= "post" and action= "mail.php" Quote Link to comment Share on other sites More sharing options...
king arthur Posted August 2, 2006 Share Posted August 2, 2006 Well it doesn't sound like the script is being run for some reason, or at least it's not getting to the IF statement. Try putting an echo in on its own somewhere just to make sure. Quote Link to comment Share on other sites More sharing options...
ryanlwh Posted August 2, 2006 Share Posted August 2, 2006 you're missing a ; after $_POST['name'], and after $_POST['age'].the reason you didn't see anything is probably that you have display error off. Quote Link to comment Share on other sites More sharing options...
timgetback Posted August 2, 2006 Author Share Posted August 2, 2006 how do you turn that on??? im really new to this stuff. thanks it tells me that the message was succesfull but when i check my email theres nothing there. Quote Link to comment Share on other sites More sharing options...
timgetback Posted August 3, 2006 Author Share Posted August 3, 2006 Ok i got another problem.... when i send my mailto.php file with the following code:[code]<?php$to = "email@domain.com";$subject = "Email Info";$info1 = $_POST['info1'];$info2 = $_POST['info2'];$body = "info1: $info1 ,info2: $info2";if (mail($to, $subject, $body)) { echo("<p>message successfully sent!</p>"); } else { echo("<p>Error Try again...</p>"); }?> [/code]It changes the mail function to an array function so it ends up like this when i load it:[code]<?php$to = "email@domain.com";$subject = "Email Info";$info1 = $_POST['info1'];$info2 = $_POST['info2'];$body = "info1: $info1 ,info2: $info2";if (array($to, $subject, $body)) { echo("<p>Message successfully sent!</p>"); } else { echo("<p>Error Try again...</p>"); }?> [/code]What should i do? cause when i leave the array function in, and add the mail function it also changes Before:[code]if (array($to, $subject, $body)) { echo("<p>Login successfully sent!</p>") mail($to, $subject, $body); } else { echo("<p>Error Try again...</p>"); }?> [/code]After:[code]if (array($to, $subject, $body)) { echo("<p>Login successfully sent!</p>") array($to, $subject, $body); } else { echo("<p>Error Try again...</p>"); }?> [/code] 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.