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 = "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.
Link to comment
Share on other sites

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?
Link to comment
Share on other sites

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]
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.