graz625 Posted September 13, 2007 Share Posted September 13, 2007 Hello, I am having problems with a form mail script that I did, I can not get it to work. I get a server 500 error when I hit the submit button. I am new to PHP programming and need some help please ! Listed below is my html code and the PHP code that I put into the CGI folder on my sever. Also , I dont know if this make a difference or not but the e-mail that I want the form information to goto is a .net address and is not the same .com as the site. Any suggestions would be very welcome !! Thanks everyone !!! HTML Form Code form action="http://www.sw-vai.com/cgi-bin/fmail.php" method="post" enctype="text/plain" name="contact" target="_blank" id="contact"> <p class="style1"><strong>Email:</strong> <label><br /> <input name="first_name" type="text" id="first_name" tabindex="1" size="45"> </label> </p> </br> <p class="style1"><strong>Company Name:</strong> <label><br /> <input name="company_name" type="text" id="company_name" tabindex="2" size="45"> </label></p></br> <p class="style1"><strong>Your Name:</strong><br /><label> <input name="your_name" type="text" id="your_name" tabindex="3" size="45"> </label> </p></br> <p class="style1"><strong>Contact Number:</strong><br /> <label> <input name="contact_number" type="text" id="contact_number" tabindex="4" value="Example: 555-555-5555" size="45”></label> </p></br> <li class="style1"><strong>Question or Product Inquiry: </p><label> <textarea name="question_products" cols="80" rows="10" id="question_products" tabindex="5"></textarea> <br> <input type="submit" name="submit" id="submit" value="Submit" tabindex="6"> </label> </strong></br> <input name="recipient" type="hidden" id="recipients" value="swcontrol@swcontrol.net"> <input name="redirect" type="hidden" value="http://www.sw-vai.com/thankyou.html"> </form> PHP CODE <?PHP $first_name = $POST[“first_name”]; $company_name = $POST[“company_name”]; $your_name = $POST[“your_name”]; $contact_number = $POST[“contact_number”]; $question_products = $POST[“question_product”]; mail( swcontrols@swcontrol.net, $first_name, $company_name, $your_name, $contact_number, $question_product ) ; header(“location: http://www.sw-vai.com/thankyou.html”); ?> Quote Link to comment https://forums.phpfreaks.com/topic/69211-sendmail-help-new-programmer/ Share on other sites More sharing options...
LiamProductions Posted September 13, 2007 Share Posted September 13, 2007 Heres a simple version of how you should do it Form.html <form method="post" action="file.php"> <input type="text" name=\"name\"> <input type="message" name="message"> <input type="submit"> file.php <?php $to = "Myemail@phpfreaks.com"; $name = $_POST['name']; $message = $_POST['message']; $subject = "Mail form"; mail($to, $subject, $message); ?> If you have a STMP server that should work also i hope it gives you an idea Take a look at http://php.net/mail Quote Link to comment https://forums.phpfreaks.com/topic/69211-sendmail-help-new-programmer/#findComment-347847 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.