Hi,
i'm trying to use a contact script, and seems like everything else is working fine, but when i test the script i get these 2 messages (At least):
Notice: Undefined variable: subject in E:Domains***** \contactfin.php on line 36
Notice: Undefined variable: subject in E:\Domains*****\contactfin.php on line 39
1. <?php
2. //If the form is submitted
3. if(isset($_POST['submit'])) {
4.
5. //Check to make sure that the name field is not empty
6. if(trim($_POST['contactname']) == '') {
7. $hasError = true;
8. } else {
9. $name = trim($_POST['contactname']);
10. }
11.
12. //Check to make sure that the subject field is not empty
13. if(trim($_POST['subject']) == '') {
14. $hasError = true;
15. } else {
16. $subject = trim($_POST['subject']);
17. }
18.
19. //Check to make sure sure that a valid email address is submitted
20. if(trim($_POST['email']) == '') {
21. $hasError = true;
22. } else if (!eregi("^[A-Z0-9._%-]+@[A-Z0-9._%-]+\.[A-Z]{2,4}$", trim($_POST['email']))) {
23. $hasError = true;
24. } else {
25. $email = trim($_POST['email']);
26. }
27.
28. //Check to make sure comments were entered
29. if(trim($_POST['message']) == '') {
30. $hasError = true;
31. } else {
32. if(function_exists('stripslashes')) {
33. $comments = stripslashes(trim($_POST['message']));
34. } else {
35. $comments = trim($_POST['message']);
36. }
37. }
38.
39. //If there is no error, send the email
40. if(!isset($hasError)) {
41. $emailTo = 'info@autovisionfinland.com'; //Put your own email address here
42. $body = "Name: $name \n\nEmail: $email \n\nSubject: $subject \n\nComments:\n $comments";
43. $headers = 'From: My Site <'.$emailTo.'>' . "\r\n" . 'Reply-To: ' . $email;
44.
45. mail($emailTo, $subject, $body, $headers);
46. $emailSent = true;
47. }
48. }
49 ?>
the form with divs and everything comes right after that code, i can copy it too if needed.
Any help is appriciated
-Thank you!!