cgiemail Noobie help

Status
Not open for further replies.

e85andyou

New Member
Messages
49
Reaction score
0
Points
0
I do not know the cgi language and I have been paying for a service just to receive emails from a form. The form i have been using is at httpL//www.driveflexfuel.com/comments.php . I tried to understand the instructions given but i can not figure out what they are getting at. I know how to make the form it is just how to get the email to send.

If it helps my email address is customerservice@driveflexfuel.com

Any help is highly appreciated

Thanks

Douglas J Cottrell
 

marshian

New Member
Messages
526
Reaction score
9
Points
0
First of all, I think the language you mean is Perl. I don't know Perl, but I'll give you a php script that does the same.
Second, your link is wrong :p

Ok, change
HTML:
<form  action="http://jotform.com/submit.php"  method="post" name="q_form_81043241129">

to
HTML:
<form method="POST" action="sendcomments.php">

change this:
HTML:
<input type="hidden" name="formID" value="81043241129" />
<div id="main"> 
<input type="hidden" id="spc" name="spc" value="spc" />
<script type="text/javascript">
   document.getElementById('spc').value = 'c4ca1d8cbf4df77436ab60e1f000d01f';
</script>
<table width="520" cellpadding="5" cellspacing="0">
 <tr >
  <td width="150" class="left" >
   <label >Name:</label>
  </td>
  <td class="right" >
   <input type="text" size="30" name="q0_Name" class="text" value="" id="q0"  maxlength="100" maxsize="100" />
  </td>
 </tr>
 <tr >
  <td width="150" class="left" >
   <label >E-mail:</label>
  </td>
  <td class="right" >
   <input type="text" size="30" name="q1_E-mail" class="text" value="" id="q1"  maxlength="100" maxsize="100" />
  </td>
 </tr>
 <tr >
  <td width="150" class="left" >
   <label >Phone:</label>
  </td>
  <td class="right" >
   <input type="text" size="30" name="q2_Phone" class="text" value="" id="q2"  maxlength="100" maxsize="100" />
  </td>
 </tr>
 <tr >
  <td width="150" class="left" valign="top"  >
   <label>Your Message:</label>
  </td>
  <td class="right" >
   <textarea cols="40" rows="6" name="q6_YourMessage" class="text" id="q6" ></textarea>
  </td>
 </tr>
 <tr >
  <td width="150" class="left" >&nbsp;
 
  </td>
  <td class="right">
  <input type="submit" class="btn" value="Send Message" />
 </td>
 </tr>
</table>
</div>

to this:
HTML:
<div id="main"> 
<table width="520" cellpadding="5" cellspacing="0">
 <tr >
  <td width="150" class="left" >
   <label >Name:</label>
  </td>
  <td class="right" >
   <input type="text" size="30" name="name" class="text" value="" id="q0"  maxlength="100" maxsize="100" />
  </td>
 </tr>
 <tr >
  <td width="150" class="left" >
   <label >E-mail:</label>
  </td>
  <td class="right" >
   <input type="text" size="30" name="email" class="text" value="" id="q1"  maxlength="100" maxsize="100" />
  </td>
 </tr>
 <tr >
  <td width="150" class="left" >
   <label >Phone:</label>
  </td>
  <td class="right" >
   <input type="text" size="30" name="phone" class="text" value="" id="q2"  maxlength="100" maxsize="100" />
  </td>
 </tr>
 <tr >
  <td width="150" class="left" valign="top"  >
   <label>Your Message:</label>
  </td>
  <td class="right" >
   <textarea cols="40" rows="6" name="message" class="text" id="q6" ></textarea>
  </td>
 </tr>
 <tr >
  <td width="150" class="left" >&nbsp;
 
  </td>
  <td class="right">
  <input type="submit" class="btn" value="Send Message" />
 </td>
 </tr>
</table>
</div>

now make a new file called "sendcomments.php" with this code:
PHP:
<?php
$name = strip_tags($_POST["name"]);
$email = strip_tags($_POST["email"]);
$phone = strip_tags($_POST["phone"]);
$message = strip_tags($_POST["message"]);

$tomail  = "<html><body>";
$tomail .= "<i>$name</i> has filled in the form located at <a href=\"http://www.driveflexfuel.com/comments.php\">http://www.driveflexfuel.com/comments.php</a>.<br>";
$tomail .= "Name: $name<br>";
$tomail .= "E-mail: $email<br>";
$tomail .= "Phone: $phone<br>";
$tomail .= "Message:<br>$message<br><br>";
$tomail .= "-- Automatic generated message --<br>";
$tomail .= "http://www.driveflexfuel.com/sendcomments.php";
$tomail .= "</body></html>";

$headers  = "From: comments <comments@driveflexfuel.com>\r\n";
$headers .= "Content-type: text/html; charset=utf-8";

mail("Customer Service <customerservice@driveflexfuel.com>","New comment",$message,$headers);
?>
<!-- Any html for a thank-you page or whatever you'ld want to show after the mail has been send goes here. //-->
<!-- I'ld reccomend deleting this note... //-->
 

e85andyou

New Member
Messages
49
Reaction score
0
Points
0
I tried what you posted and it sends the message but does not send the Name, Email or phone #. I am trying to figure out why it wont send but if someone can help me figure it out i would be grateful.

Thanks
 

marshian

New Member
Messages
526
Reaction score
9
Points
0
When I test it, it all works fine :s
Maybe somebody else can help?
 

e85andyou

New Member
Messages
49
Reaction score
0
Points
0
I have been unable to get the form to work properly. I would also like to thank the idiot that used my code to spam the hell out of my inbox. Get a life. If anyone can help me figure out how to get all the fields to send to my email which has now changed thank you very much.
 

marshian

New Member
Messages
526
Reaction score
9
Points
0
Try this:
HTML:
<form action="sendcomments.php" method="post">
  <table border="0" cellpadding="3" cellspacing="2" align="center">
    <tr><td colspan="2">Fill in what you please all fields are optional.  Your information will not be sold or given to third parties. It will be used only for contact purposes. View our <a href="http://driveflexfuel.com/policies.php"><font color="blue">Privacy Policy</font></a></td></tr>

<tr>
      <td align="right">Name:</td>
      <td>
        <input name="name" type="text" id="name" size="35" maxlength="80">
      </td>
    </tr>

    <tr>
      <td align="right">E-mail:</td>
      <td><input name="e-mail" type="text" id="e-mail" size="35" maxlength="80"></td>
    </tr>

    <tr>
      <td align="right">Phone:</td>
      <td><input name="phone" type="text" id="phone" size="35" maxlength="80"></td>
    </tr>

  <td valign="top" align="right">
   Prefered<br>Contact Method
  </td>
  <td>
   <select name="method" id="method" style="width: 237px;">
    <option>Choose One</option>
    <option>Email</option>
    <option>Phone</option>
   </select>
  </td>
 </tr>

    <tr>
      <td align="right" valign="top">Message:</td>
      <td>
        <textarea name="comments" cols="35" rows="6" id="comments"></textarea>
      </td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td>
        <input type="submit" name="Submit" value="Submit Message">
      </td>
    </tr>
  </table>
</form>
to
HTML:
<form action="sendcomments.php" method="post">
  <table border="0" cellpadding="3" cellspacing="2" align="center">
    <tr><td colspan="2">Fill in what you please all fields are optional.  Your information will not be sold or given to third parties. It will be used only for contact purposes. View our <a href="http://driveflexfuel.com/policies.php"><font color="blue">Privacy Policy</font></a></td></tr>

<tr>
      <td align="right">Name:</td>
      <td>
        <input name="name" type="text" id="name" size="35" maxlength="80">
      </td>
    </tr>

    <tr>
      <td align="right">E-mail:</td>
      <td><input name="e-mail" type="text" id="e-mail" size="35" maxlength="80"></td>
    </tr>

    <tr>
      <td align="right">Phone:</td>
      <td><input name="phone" type="text" id="phone" size="35" maxlength="80"></td>
    </tr>

  <td valign="top" align="right">
   Prefered<br>Contact Method
  </td>
  <td>
   <select name="method" id="method" style="width: 237px;">
    <option value="blank">Choose One</option>
    <option value="e-mail">Email</option>
    <option value="phone">Phone</option>
   </select>
  </td>
 </tr>

    <tr>
      <td align="right" valign="top">Message:</td>
      <td>
        <textarea name="comments" cols="35" rows="6" id="comments"></textarea>
      </td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td>
        <input type="submit" name="Submit" value="Submit Message">
      </td>
    </tr>
  </table>
</form>

and sendmail.php:
PHP:
<?php 
$name = strip_tags($_POST["name"]); 
$email = strip_tags($_POST["e-mail"]); 
$phone = strip_tags($_POST["phone"]); 
$method = strip_tags($_POST["method"]);
$message = strip_tags($_POST["message"]); 

$tomail  = "<html><body>"; 
$tomail .= "<i>$name</i> has filled in the form located at <a href=\"http://www.driveflexfuel.com/comments.php\">http://www.driveflexfuel.com/comments.php</a>.<br>"; 
$tomail .= "<b>Name</b>: $name<br>"; 
$tomail .= "<b>E-mail</b>: $email<br>"; 
$tomail .= "<b>Phone</b>: $phone<br>"; 
$tomail .= "<b>Preferred contact method</b>: $method<br>";
$tomail .= "<b>Message</b>:<br>$message<br><br>"; 
$tomail .= "-- Automatic generated message --<br>"; 
$tomail .= "http://www.driveflexfuel.com/sendcomments.php"; 
$tomail .= "</body></html>"; 

$headers  = "From: comments <comments@driveflexfuel.com>\r\n"; 
$headers .= "Content-type: text/html; charset=utf-8"; 

mail("Customer Service <customerservice@driveflexfuel.com>","New comment",$message,$headers); 
?> 
<!-- Any html for a thank-you page or whatever you'ld want to show after the mail has been send goes here. //--> 
<!-- I'ld reccomend deleting this note... //-->

Note: this is the previous code altered so it'll work with your new form, but if the previous code didn't work, this might have the same flaws. But it'ld be strange if it didn't work, because my tests do.
 
Status
Not open for further replies.
Top