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="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”);

?>

 

Link to comment
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 = "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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.