Jump to content

Help!? Php errors...


pemdas21

Recommended Posts

Here is the code for the php:

<?PHP
$email = $HTTP_POST_VARS[email];
$Person = $HTTP_POST_VARS[Person];
if ($Person == "John Smith") {
$mailto = "[email protected]";
}
if ($Person == "George Smith") {
$mailto = "[email protected]";
}
// repeat the above If statement as many times as the persons
$mailsubj = $HTTP_POST_VARS[Subject];
$Message = $HTTP_POST_VARS[Message];
$mailhead = "From: $email\n";
$mailbody = "$Message\n"
. "\n"
. "Email sent through our Web Mail form\n" ;
mail($mailto, $mailsubj, $mailbody, $mailhead);
?>

Here are the errors:

Notice: Use of undefined constant email - assumed 'email' in C:\Sites\www.orrita.com\new\emails.php on line 2

Notice: Undefined index: email in C:\Sites\www.orrita.com\new\emails.php on line 2

Notice: Use of undefined constant Person - assumed 'Person' in C:\Sites\www.orrita.com\new\emails.php on line 3

Notice: Use of undefined constant Subject - assumed 'Subject' in C:\Sites\www.orrita.com\new\emails.php on line 89

Notice: Use of undefined constant Message - assumed 'Message' in C:\Sites\www.orrita.com\new\emails.php on line 90

Notice: Undefined variable: mailto in C:\Sites\www.orrita.com\new\emails.php on line 95

Warning: mail(): SMTP server response: 554 Error: no valid recipients in C:\Sites\www.orrita.com\new\emails.php on line 95


Link to comment
https://forums.phpfreaks.com/topic/32355-help-php-errors/
Share on other sites

<?PHP
$email = $HTTP_POST_VARS['email'];
$Person = $HTTP_POST_VARS['Person'];
if ($Person == "John Smith") {
$mailto = "[email protected]";
}
if ($Person == "George Smith") {
$mailto = "[email protected]";
}
// repeat the above If statement as many times as the persons
$mailsubj = $HTTP_POST_VARS['Subject'];
$Message = $HTTP_POST_VARS['Message'];
$mailhead = "From: $email\n";
$mailbody = "$Message\n"
. "\n"
. "Email sent through our Web Mail form\n" ;
mail($mailto, $mailsubj, $mailbody, $mailhead);
?>
Link to comment
https://forums.phpfreaks.com/topic/32355-help-php-errors/#findComment-150248
Share on other sites

If I must...

[code]
<?php
  if (isset($_POST['email') && isset($_POST['Person']) && isset($_POST['Message']) && isset($_POST['Subject'])) {
    $email  = $_POST['email'];
    $Person = $_POST['Person'];
    if ($Person == "John Smith") {
      $mailto = "[email protected]";
    }
    if ($Person == "George Smith") {
      $mailto = "[email protected]";
    }
    $mailsubj = $_POST['Subject'];
    $Message = $_POST['Message'];
    $mailhead = "From: $email\n";
    $mailbody = "$Message\n\nEmail sent through our Web Mail form\n" ;
    mail($mailto, $mailsubj, $mailbody, $mailhead);
  }
?>
[/code]
Link to comment
https://forums.phpfreaks.com/topic/32355-help-php-errors/#findComment-150250
Share on other sites

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.