OK I have created a simple form that I want to email me the results... but is doen't work. I also would like a thankyou.html to load upon submital. Can someone please tell me what is wrong with my html form or php file? I am very new to the world of server side scripting. Here's the details: HTML FORM CODE: <td style="width:220px;"><table border="0" cellpadding="0" cellspacing="0" style="width:185px;"> <tr> <td style="height:233px;"><form action="http://www.mywebpage.com/cgi-bin/contactx.php" id="form"><table border="0" cellpadding="0" cellspacing="0" style="margin:12px 0 0 18px; width:181px;"> <tr><td><img src="images/7title4.jpg" alt="" style="margin-bottom:17px;"></td></tr> <tr> <td><label> <input name="name" type="text" id="name" value="Name:"> </label></td> </tr> <tr><td><img src="images/spacer.gif" width="1" height="8" alt=""></td></tr> <tr> <td><label> <input name="email" type="text" id="email" value="Email:"> </label></td> </tr> <tr><td><img src="images/spacer.gif" width="1" height="8" alt=""></td></tr> <tr> <td><label> <textarea name="message" id="message" cols="45" rows="5">Message: </textarea> </label></td> </tr> <tr> <td><table border="0" cellpadding="0" cellspacing="0" style="margin:5px 0 0 80px;" class="kn"> <tr> <td width="60" style="width:60px;"><a href="#" onclick="document.getElementById('form').reset()">clear</a><img src="images/ch_1.jpg" style="margin-left:4px; margin-top:5px;" alt=""></td> <td width="39"><a href="#" onclick="document.getElementById('form').submit()">send</a> <img src="images/ch_1.jpg" style="margin-left:4px; margin-top:5px;" alt=""></td> </tr> </table></td> </tr> </table></form></td> </tr> </table></td> </tr> </table></td> AND THE PHP: <?php $name = $_POST['name']; $email = $_POST['email']; $message = $_POST['message']; $to = "myemail@mail.com"; $subject = $_POST['subject']; $msg = $message . $_POST['name'] . $getip; $headers = "From: " . $_POST['sender_email'] . "\r\nReply-To:" . $_POST['sender_email']; mail("$to", "$subject", "$msg", "$headers"); ?>
thanks for the fast reply... here is what is says: Notice: Undefined index: name in C:\Accounts\ashworth\wwwRoot\cgi-bin\contactx.php on line 5 Notice: Undefined index: email in C:\Accounts\ashworth\wwwRoot\cgi-bin\contactx.php on line 6 Notice: Undefined index: message in C:\Accounts\ashworth\wwwRoot\cgi-bin\contactx.php on line 7 Notice: Undefined index: subject in C:\Accounts\ashworth\wwwRoot\cgi-bin\contactx.php on line 12 Notice: Undefined index: name in C:\Accounts\ashworth\wwwRoot\cgi-bin\contactx.php on line 13 Notice: Undefined variable: getip in C:\Accounts\ashworth\wwwRoot\cgi-bin\contactx.php on line 13 Notice: Undefined index: sender_email in C:\Accounts\ashworth\wwwRoot\cgi-bin\contactx.php on line 14 Notice: Undefined index: sender_email in C:\Accounts\ashworth\wwwRoot\cgi-bin\contactx.php on line 14
replace 1 with 2: 1 <form action="http://www.mywebpage.com/cgi-bin/contactx.php" id="form"> HTML: 2 <form method="post" action="http://www.mywebpage.com/cgi-bin/contactx.php" id="form"> HTML:
Thank you very much for your help... I can now recieve the email but it doesn't show a sender or subject. Here are the remaning errors that occur Notice: Undefined index: subject in C:\Accounts\ashworth\wwwRoot\cgi-bin\contactx.php on line 12 Notice: Undefined variable: getip in C:\Accounts\ashworth\wwwRoot\cgi-bin\contactx.php on line 13 Notice: Undefined index: sender_email in C:\Accounts\ashworth\wwwRoot\cgi-bin\contactx.php on line 14 Notice: Undefined index: sender_email in C:\Accounts\ashworth\wwwRoot\cgi-bin\contactx.php on line 14