Forum Moderators: coopster
Undefined variable: email in /home/example/public_html/phpscript.php on line 26
10 <?php>
11 if (isset($_POST['send'])) {
12 $to = 'info@example.com';
13 $subject = 'Contact request';
14 $message = 'Email: ' . $_POST['email'] . "\r\n\r\n";
15 $message .= 'Subject: ' . $_POST['subject'] . "\r\n\r\n";
16 $message .= 'Comments: ' . $_POST['comments'];
17 $headers = "From: webmaster@example.com\r\n";
18 $headers .= 'Content-Type: text/plain; charset=utf-8';
19 $email = filter_input(INPUT_POST, 'email', FILTER_VALIDATE_EMAIL);
20 if ($email) {
21 $headers .= "\r\nReply-To: $email";
22 $success = mail($to, $subject, $message, $headers, '-finfo@example.com');
23 }
24 }
25
26 if ($email) { ?>
27
28 <h1>Thank you blah blah.</h1>
29 <?php
30 } else { ?>
31 <h1>Ooops! blah blah.</h1>
32 <?php } if(isset($success) && $success === true) {