Hi Everyone

Im a bit stuck iv got this code below but im getting two errors

<?php

$to = "EMAIL ADDRESS REMOVED";
$subject = "website feedback";
$from = $POST['name'];
$email = $
POST['email'];
$comment = $_POST['comment'];

mail($to, $subject, $comment,"From: $from");

$htmlbody = "<p>Thank you for your comments. ";
$htmlbody .= "The following comment:<br />$comment<br />";
$htmlbody .= "was sent from$from</p>";
$htmlout = "<html><head></head><body>". $htmlbody. "</body></html>";
echo $htmlout;

$header = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"';
$header .= ' "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">';
$htmlhead = '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">';
$htmlhead .= '<head><title>Getting Student Info</title>';
$htmlhead .= '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /></head>';
$htmlbody = '<body>';

echo $header . $htmlhead . $htmlbody;
?>

But i get
Notice: Undefined index: name in on line 5

Notice: Undefined index: email on line 6

anyone got any ideas as i cant figure it out

🙁

    It's because those 2 indexes aren't in the $POST array. Make sure that the spelling matches that on the referring form. You can also check the contents of the $POST array at the top to inspect the contents.

    var_dump($_POST);

    or

    echo '<pre>';      // Using PRE for readability
    print_r($_POST);
    echo '</pre>';
    
      Write a Reply...