Jump to content

Sendmail help - new programmer


graz625

Recommended Posts

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="[email protected]">

<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( [email protected], $first_name, $company_name, $your_name, $contact_number, $question_product ) ;

header(“location: http://www.sw-vai.com/thankyou.html”);

?>

 

Link to comment
https://forums.phpfreaks.com/topic/69211-sendmail-help-new-programmer/
Share on other sites

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 = "[email protected]";
$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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.