PHP Formulaire de contact Problème

  • CXLink
  • Expert
  • Expert
  • Avatar de l’utilisateur
  • Inscription: Nov 22, 2004
  • Messages: 684
  • Loc: ATL-GA
  • Status: Offline

Message Septembre 28th, 2009, 5:06 am

Ci-dessous le code, je me sers. Les validations semblent bien fonctionner (donc je ne poste pas, mais je peux si nécessaire). Tout semble comme il fonctionne mais quand je reçois l'email qu'il n'a pas toutes les variables en elle. Toute aide est appréciée.

Merci

HTML
Code: [ Select ]
<form action="emailcon.php" name="form1" id="form1" onSubmit="return validateForm()">
<table width="480" border="0" align="center" cellpadding="5" cellspacing="5">
 <tr class="style1">
  <td colspan="2" valign="top" class="fmtitle"><div align="right">Name*</div></td>
  <td width="240" align="left"><input name="name" id="name" type="text" class="fminput" size="30"/></td>
 </tr>
 <tr class="style1">
  <td colspan="2" valign="top" class="fmtitle"><div align="right">Email Address*</div></td>
  <td><input name="email" id="email" type="text" class="fminput" size="30"/></td>
 </tr>
 <tr class="style1">
  <td colspan="2" valign="top" class="fmtitle"><div align="right">Confirm Email*</div></td>
  <td><input name="emailc" id="emailc" type="text" class="fminput" size="30"/></td>
 </tr>
 <tr class="style1">
  <td colspan="2" valign="top" class="fmtitle"><div align="right">Phone</div></td>
  <td><input name="phone" id="phone" type="text" class="fminput" size="30"/></td>
 </tr>
 <tr class="style1">
  <td colspan="2" valign="top" class="fmtitle"><div align="right">Company</div></td>
  <td><input name="company" id="company" type="text" class="fminput" size="30"/></td>
 </tr>
 <tr class="style1">
  <td colspan="2" valign="top" class="fmtitle"><div align="right">Subject*</div></td>
  <td>
   <select name="subject" id="subject">
    <option selected value="clear">Select Subject</option>
    <option value="RequestDetails">Request Details</option>
    <option value="RequestDemo">Request Demo</option>
    <option value="reqinf">Request Information</option>
    <option value="other">Other</option>
   </select>
  </td>
 </tr>
 <tr class="style1">
  <td colspan="2" valign="top" class="fmtitle"><div align="right">Message</div></td>
  <td align="left"><textarea name="message" id="message" class="fminput" cols="30" rows="6"></textarea></td>
 </tr>
 <tr class="style1">
  <td width="29">&nbsp;</td>
  <td width="173">&nbsp;</td>
  <td align="right"><input type="submit" name="Submit" value="Submit"/></td>
 </tr>
</table>
</form>
  1. <form action="emailcon.php" name="form1" id="form1" onSubmit="return validateForm()">
  2. <table width="480" border="0" align="center" cellpadding="5" cellspacing="5">
  3.  <tr class="style1">
  4.   <td colspan="2" valign="top" class="fmtitle"><div align="right">Name*</div></td>
  5.   <td width="240" align="left"><input name="name" id="name" type="text" class="fminput" size="30"/></td>
  6.  </tr>
  7.  <tr class="style1">
  8.   <td colspan="2" valign="top" class="fmtitle"><div align="right">Email Address*</div></td>
  9.   <td><input name="email" id="email" type="text" class="fminput" size="30"/></td>
  10.  </tr>
  11.  <tr class="style1">
  12.   <td colspan="2" valign="top" class="fmtitle"><div align="right">Confirm Email*</div></td>
  13.   <td><input name="emailc" id="emailc" type="text" class="fminput" size="30"/></td>
  14.  </tr>
  15.  <tr class="style1">
  16.   <td colspan="2" valign="top" class="fmtitle"><div align="right">Phone</div></td>
  17.   <td><input name="phone" id="phone" type="text" class="fminput" size="30"/></td>
  18.  </tr>
  19.  <tr class="style1">
  20.   <td colspan="2" valign="top" class="fmtitle"><div align="right">Company</div></td>
  21.   <td><input name="company" id="company" type="text" class="fminput" size="30"/></td>
  22.  </tr>
  23.  <tr class="style1">
  24.   <td colspan="2" valign="top" class="fmtitle"><div align="right">Subject*</div></td>
  25.   <td>
  26.    <select name="subject" id="subject">
  27.     <option selected value="clear">Select Subject</option>
  28.     <option value="RequestDetails">Request Details</option>
  29.     <option value="RequestDemo">Request Demo</option>
  30.     <option value="reqinf">Request Information</option>
  31.     <option value="other">Other</option>
  32.    </select>
  33.   </td>
  34.  </tr>
  35.  <tr class="style1">
  36.   <td colspan="2" valign="top" class="fmtitle"><div align="right">Message</div></td>
  37.   <td align="left"><textarea name="message" id="message" class="fminput" cols="30" rows="6"></textarea></td>
  38.  </tr>
  39.  <tr class="style1">
  40.   <td width="29">&nbsp;</td>
  41.   <td width="173">&nbsp;</td>
  42.   <td align="right"><input type="submit" name="Submit" value="Submit"/></td>
  43.  </tr>
  44. </table>
  45. </form>


PHP
Code: [ Select ]
<?php

import_request_variables("P","par_");

$sendTo = "recipient@email.com";
$subject = "ContactUS: " . $par_subject;

$headers = "From: " . $par_name;
$headers .= "<" . $par_email . ">\r\n";
$headers .= "Reply-To: " . $par_email . "\r\n";
$headers .= "Return-Path: " . $par_email;

$message .= "Name: " . $par_name . "\r\n";
$message .= "Company: " . $par_company . "\r\n";
$message .= "Phone: " . $par_phone . "\r\n";
$message .= $par_message;

mail($sendTo, $subject, $message, $headers);

$url = "http://www.website.com/contactc.html"; // target of the redirect
$delay = "0"; // 3 second delay

echo '<meta http-equiv="refresh" content="'.$delay.';url='.$url.'">';
?>
  1. <?php
  2. import_request_variables("P","par_");
  3. $sendTo = "recipient@email.com";
  4. $subject = "ContactUS: " . $par_subject;
  5. $headers = "From: " . $par_name;
  6. $headers .= "<" . $par_email . ">\r\n";
  7. $headers .= "Reply-To: " . $par_email . "\r\n";
  8. $headers .= "Return-Path: " . $par_email;
  9. $message .= "Name: " . $par_name . "\r\n";
  10. $message .= "Company: " . $par_company . "\r\n";
  11. $message .= "Phone: " . $par_phone . "\r\n";
  12. $message .= $par_message;
  13. mail($sendTo, $subject, $message, $headers);
  14. $url = "http://www.website.com/contactc.html"; // target of the redirect
  15. $delay = "0"; // 3 second delay
  16. echo '<meta http-equiv="refresh" content="'.$delay.';url='.$url.'">';
  17. ?>
Push-Here ::: Web Design + Identity
WordPress - like mayonnaise - goes great with anything
We adore chaos because we love to produce order. -M. C. Escher
  • Anonymous
  • Bot
  • No Avatar
  • Inscription: 25 Feb 2008
  • Messages: ?
  • Loc: Ozzuland
  • Status: Online

Message Septembre 28th, 2009, 5:06 am

  • Bigwebmaster
  • Site Admin
  • Site Admin
  • Avatar de l’utilisateur
  • Inscription: Déc 20, 2002
  • Messages: 8934
  • Loc: Seattle, WA & Phoenix, AZ
  • Status: Offline

Message Septembre 28th, 2009, 9:11 am

Dans votre code HTML Assurez-vous que vous avez method = "post" comme je le crois, par défaut il s'agit d'une requête GET lorsque vous ne spécifiez pas une méthode. Quand vous dites:

PHP Code: [ Select ]
import_request_variables("P","par_");


Vous dites que regarder pour les variables de poste. Ainsi:

HTML Code: [ Select ]
<form action="emailcon.php" name="form1" id="form1" onSubmit="return validateForm()">


devrait probablement être:

HTML Code: [ Select ]
<form action="emailcon.php" name="form1" id="form1" onSubmit="return validateForm()" method="post">


Faites-moi savoir si cela l'arrange.
Ozzu Hosting - Want your website on a fast server like Ozzu?
  • CXLink
  • Expert
  • Expert
  • Avatar de l’utilisateur
  • Inscription: Nov 22, 2004
  • Messages: 684
  • Loc: ATL-GA
  • Status: Offline

Message Septembre 28th, 2009, 10:40 am

Accomplit des merveilles. Merci Brian.
Push-Here ::: Web Design + Identity
WordPress - like mayonnaise - goes great with anything
We adore chaos because we love to produce order. -M. C. Escher

Afficher de l'information

  • Total des messages de ce sujet: 3 messages
  • Utilisateurs parcourant ce forum: Aucun utilisateur enregistré et 106 invités
  • Vous ne pouvez pas poster de nouveaux sujets
  • Vous ne pouvez pas répondre aux sujets
  • Vous ne pouvez pas éditer vos messages
  • Vous ne pouvez pas supprimer vos messages
  • Vous ne pouvez pas joindre des fichiers
 
 

© 2011 Unmelted, LLC. Ozzu® est une marque déposée de Unmelted, LLC