Jump to content

Ok simple question looking for simple answer.....


timgetback

Recommended Posts

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 = "[email protected]";
$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.
If you're not seeing anything, my first suggestion would be to change <? to <?php
The 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?
Ok i got another problem.... when i send my mailto.php file with the following code:

[code]<?php
$to = "[email protected]";
$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 protected]";
$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]

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.