Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP Form Email Request Not Bringing form data through
    primarykey
    data
    text
    <p>I have been working on a php script and a html form (both in separate files) that takes data from a form and emails it to me. I am having difficulty getting the form data that the user fills out to come through on the email. I would like for the email to contain the user's email as the From in the email.</p> <p>Can anyone help me figure out what is wrong with the files?</p> <p>HTML Form:</p> <pre><code>&lt;form id="ContactUs" name="ContactUs" method="post" action="sendform/sendform.php"&gt; &lt;table width="60%" border="0" cellpadding="2px" style="position:relative; left:20%"&gt; &lt;tr&gt; &lt;td width="25%" align="right"&gt;Name:&lt;/td&gt; &lt;td width="75%" align="left"&gt;&lt;input name="ContactName" type="text" size="40" maxlength="100" /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td align="right"&gt;Email Address:&lt;/td&gt; &lt;td align="left"&gt;&lt;span id="sprytextfield1"&gt; &lt;input name="EmailAddress" type="text" id="EmailAddress" size="40" maxlength="150" /&gt; &lt;span class="textfieldRequiredMsg"&gt;A value is required.&lt;/span&gt;&lt;/span&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td align="right"&gt;Phone Number:&lt;/td&gt; &lt;td align="left"&gt;&lt;span id="sprytextfield2"&gt; &lt;label for="PhoneNumber"&gt;&lt;/label&gt; &lt;input name="PhoneNumber" type="text" id="PhoneNumber" maxlength="15" /&gt; &lt;span class="textfieldRequiredMsg"&gt;A value is required.&lt;/span&gt;&lt;/span&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td align="right"&gt;Practice Name:&lt;/td&gt; &lt;td align="left"&gt;&lt;input name="PracticeName" type="text" size="40" maxlength="100" /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td align="right"&gt;Message:&lt;/td&gt; &lt;td align="left"&gt;&lt;textarea name="Message" cols="40" rows="10"&gt;&amp;nbsp;&lt;/textarea&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td align="center" width="25%"&gt;&lt;/td&gt; &lt;td align="center" width="75%"&gt;&lt;input name="SubmitForm" type="submit" id="SubmitForm" onclick="MM_popupMsg('Are you sure you would like to submit this form?\r');return document.MM_returnValue" value="Submit Form" /&gt;&lt;input type="reset" name="ResetForm" id="ResetForm" value="Reset Form" /&gt;&lt;/td&gt; &lt;/table&gt; &lt;/form&gt; </code></pre> <p>Separate PHP file named sendform.php</p> <pre><code>&lt;?php // Where to redirect after form is processed. $url = 'ThankYou.php'; // multiple recipients $to = 'T@domain.com'; // subject $subject = 'Someone sent you a contact request'; $headers = 'From: '.$EmailAddress.'/r/n'; $headers .= 'MIME-Version: 1.0\r\n'; $headers .= 'Content-Type: text/html; charshet=ISO-8859-1\r\n'; // message $messagetext = '&lt;html&gt;&lt;body&gt;'; $messagetext .= ' &lt;p&gt;Website Form Submit&lt;/p&gt;'; $messagetext .= ' &lt;table&gt;'; $messagetext .= ' &lt;tr&gt;&lt;td align="right"&gt;Name:&lt;/td&gt;&lt;td&gt;'; $_GET[$ContactName] .'&lt;/td&gt;&lt;/tr&gt;'; $messagetext .= ' &lt;tr&gt;&lt;td align="right"&gt;Email Address:&lt;/td&gt;&lt;td align="left"&gt;'; $EmailAddress .'&lt;/td&gt;&lt;/tr&gt;'; $messagetext .= ' &lt;tr&gt;&lt;td align="right"&gt;Phone Number:&lt;/td&gt;&lt;td align="left"&gt;'; $PhoneNumber .'&lt;/td&gt;&lt;/tr&gt;'; $messagetext .= ' &lt;tr&gt;&lt;td align="right"&gt;Practice Name:&lt;/td&gt;&lt;td align="left"&gt;'; $PracticeName .'&lt;/td&gt;&lt;/tr&gt;'; $messagetext .= ' &lt;tr&gt;&lt;td align="right"&gt;Message:&lt;/td&gt;&lt;td align="left"&gt;'; $Message .'&lt;/textarea&gt;&lt;/td&gt;&lt;/tr&gt;'; $messagetext .= ' &lt;/table&gt;&lt;/body&gt;&lt;/html&gt;'; // To send HTML mail, the Content-type header must be set $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; // Mail it mail($to, $subject, $messagetext, $headers); //echo $message; echo '&lt;META HTTP-EQUIV=Refresh CONTENT="0; URL='.$url.'"&gt;' ?&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload