<?xml version="1.0" encoding="utf-8" ?><rss version="2.0" xml:base="https://www.webmaster-forums.net/crss/node/1051753" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title></title>
    <link>https://www.webmaster-forums.net/crss/node/1051753</link>
    <description></description>
    <language>en</language>
          <item>
    <title>I happen to be using the very</title>
    <link>https://www.webmaster-forums.net/web-programming-and-application-development/php-form-help#comment-1288920</link>
    <description> &lt;p&gt;I happen to be using the very same form that the lady above was using. However, I have recently switched my website platform over from php to shtml. I have renamed all of my pages to shtml. My previous php pages are loading whenever someone clicks on them from search engines. But, I am having a terrible time getting any php feedback form to work.&lt;/p&gt;
&lt;p&gt;My domain is also with Godaddy and I have spoken with them. They said that they ran a test on my site with their own mail form and it functioned properly. They said that the problem lies within my script.&lt;/p&gt;
&lt;p&gt;Well, the form itself loads perfectly, but once I fill out the form and click &quot;submit&quot; then I get the following error messages. What does all this mean?&lt;/p&gt;
&lt;p&gt;&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;&amp;quot;; echo $error.&amp;quot;&lt;br /&gt;&lt;br /&gt;&amp;quot;; echo &amp;quot;Please go back and fix these errors.&lt;br /&gt;&lt;br /&gt;&amp;quot;; die(); } // validation expected data exists if(!isset($_POST[&amp;#039;first_name&amp;#039;]) || !isset($_POST[&amp;#039;last_name&amp;#039;]) || !isset($_POST[&amp;#039;email&amp;#039;]) || !isset($_POST[&amp;#039;telephone&amp;#039;]) || !isset($_POST[&amp;#039;comments&amp;#039;])) { died(&amp;#039;We are sorry, but there appears to be a problem with the form you submitted.&amp;#039;); } $first_name = $_POST[&amp;#039;first_name&amp;#039;]; // required $last_name = $_POST[&amp;#039;last_name&amp;#039;]; // required $email_from = $_POST[&amp;#039;email&amp;#039;]; // required $telephone = $_POST[&amp;#039;telephone&amp;#039;]; // not required $comments = $_POST[&amp;#039;comments&amp;#039;]; // required $error_message = &amp;quot;&amp;quot;; $email_exp = &amp;#039;/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/&amp;#039;; if(!preg_match($email_exp,$email_from)) { $error_message .= &amp;#039;The Email Address you entered does not appear to be valid.&lt;br /&gt;&amp;#039;; } $string_exp = &amp;quot;/^[A-Za-z .&amp;#039;-]+$/&amp;quot;; if(!preg_match($string_exp,$first_name)) { $error_message .= &amp;#039;The First Name you entered does not appear to be valid.&lt;br /&gt;&amp;#039;; } if(!preg_match($string_exp,$last_name)) { $error_message .= &amp;#039;The Last Name you entered does not appear to be valid.&lt;br /&gt;&amp;#039;; } if(strlen($comments) &amp;lt; 2) { $error_message .= &amp;#039;The Comments you entered do not appear to be valid.&lt;br /&gt;&amp;#039;; } if(strlen($error_message) &amp;gt; 0) { died($error_message); } $email_message = &amp;quot;Form details below.\n\n&amp;quot;; function clean_string($string) { $bad = array(&amp;quot;content-type&amp;quot;,&amp;quot;bcc:&amp;quot;,&amp;quot;to:&amp;quot;,&amp;quot;cc:&amp;quot;,&amp;quot;href&amp;quot;); return str_replace($bad,&amp;quot;&amp;quot;,$string); } $email_message .= &amp;quot;First Name: &amp;quot;.clean_string($first_name).&amp;quot;\n&amp;quot;; $email_message .= &amp;quot;Last Name: &amp;quot;.clean_string($last_name).&amp;quot;\n&amp;quot;; $email_message .= &amp;quot;Email: &amp;quot;.clean_string($email_from).&amp;quot;\n&amp;quot;; $email_message .= &amp;quot;Telephone: &amp;quot;.clean_string($telephone).&amp;quot;\n&amp;quot;; $email_message .= &amp;quot;Comments: &amp;quot;.clean_string($comments).&amp;quot;\n&amp;quot;; // create email headers $headers = &amp;#039;From: &amp;#039;.$email_from.&amp;quot;\r\n&amp;quot;. &amp;#039;Reply-To: &amp;#039;.$email_from.&amp;quot;\r\n&amp;quot; . &amp;#039;X-Mailer: PHP/shtml&amp;#039; . phpversion(); if (!mail($email_to, $email_subject, $email_message, $headers)) { die (&amp;quot;There was an error sending the mail&amp;quot;); } ?&amp;gt; Thank you for your feedback.&amp;nbsp; &lt;/code&gt;&lt;/div&gt;&lt;/p&gt;
 </description>
     <pubDate>Mon, 22 Sep 2014 05:37:55 +0000</pubDate>
 <dc:creator>benedizione</dc:creator>
 <guid isPermaLink="false">comment 1288920 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>Glad it is working. One other</title>
    <link>https://www.webmaster-forums.net/web-programming-and-application-development/php-form-help#comment-1275420</link>
    <description> &lt;p&gt;Glad it is working. One other thing for in case you need it:&lt;/p&gt;
&lt;p&gt;If you need to use BCC (so that it goes to an address, but the TO: recipients do not see that it is going there), you can add that in the following code that you have:&lt;br /&gt;
&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;// create email headers&lt;br /&gt;$headers = &amp;#039;From: &amp;#039;.$email_from.&amp;quot;\r\n&amp;quot;.&lt;br /&gt;&amp;#039;Reply-To: &amp;#039;.$email_from.&amp;quot;\r\n&amp;quot; .&lt;br /&gt;&amp;#039;X-Mailer: PHP/&amp;#039; . phpversion();&lt;br /&gt;@mail($email_to, $email_subject, $email_message, $headers); &lt;/code&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;Also works for CC. &lt;/p&gt;
&lt;p&gt;&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;// create email headers&lt;br /&gt;$headers = &amp;#039;From: &amp;#039;.$email_from.&amp;quot;\r\n&amp;quot;.&lt;br /&gt;&amp;#039;Reply-To: &amp;#039;.$email_from.&amp;quot;\r\n&amp;quot; .&lt;br /&gt;&amp;#039;BCC: client.form@mydomain.com&amp;#039;.&amp;quot;\r\n&amp;quot; .&lt;br /&gt;&amp;#039;CC: sales@clientdomain.com&amp;#039;.&amp;quot;\r\n&amp;quot; .&lt;br /&gt;&amp;#039;X-Mailer: PHP/&amp;#039; . phpversion();&lt;br /&gt;if (!mail($email_to, $email_subject, $email_message, $headers)) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; die (&amp;quot;There was an error sending mail&amp;quot;);&lt;br /&gt;} &lt;/code&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;(in the above example, for hosting clients who are not active with their sites and they want the service, I keep an eye on contact form submissions, so can make sure if anything urgent comes in, I can alert them to it for immediate attention.)&lt;/p&gt;
&lt;p&gt;-Greg&lt;/p&gt;
 </description>
     <pubDate>Thu, 17 May 2012 00:39:00 +0000</pubDate>
 <dc:creator>Greg K</dc:creator>
 <guid isPermaLink="false">comment 1275420 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>SUCCESS!! The multiple email</title>
    <link>https://www.webmaster-forums.net/web-programming-and-application-development/php-form-help#comment-1275419</link>
    <description> &lt;p&gt;SUCCESS!! The multiple email address instructions fixed it completely. Thank you very much, and I hope this helps anyone else that has this difficulty =D&lt;/p&gt;
 </description>
     <pubDate>Wed, 16 May 2012 23:19:18 +0000</pubDate>
 <dc:creator>TigerPrincess</dc:creator>
 <guid isPermaLink="false">comment 1275419 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>It means that $email_to is an</title>
    <link>https://www.webmaster-forums.net/web-programming-and-application-development/php-form-help#comment-1275403</link>
    <description> &lt;p&gt;It means that $email_to is an actual array of values, and not a simple string, which is required for the mail function (this is probably what was killing your code to, but you had it set to hide the error).&lt;/p&gt;
&lt;p&gt;Check to make sure that $email_to  is set to just a single email address. ex:&lt;br /&gt;
&lt;code&gt;$email_to = &amp;quot;user@domain.com&amp;quot;;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;If you have more than one you need to send it to, you can use:&lt;br /&gt;
&lt;code&gt;$email_to = &amp;quot;user1@domain1.com,user2@domain2.com&amp;quot;;&amp;nbsp; &lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Note, no spaces, separated by commas&lt;/p&gt;
&lt;p&gt;To test what you have, right before the mail() function, you can do:&lt;br /&gt;
&lt;code&gt;var_dump($email_to);&lt;/code&gt;&lt;br /&gt;
and this will show you if it is a single string or an array of values.&lt;/p&gt;
&lt;p&gt;-Greg&lt;/p&gt;
 </description>
     <pubDate>Wed, 16 May 2012 00:45:00 +0000</pubDate>
 <dc:creator>Greg K</dc:creator>
 <guid isPermaLink="false">comment 1275403 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>What does this mean?
Warning:</title>
    <link>https://www.webmaster-forums.net/web-programming-and-application-development/php-form-help#comment-1275402</link>
    <description> &lt;p&gt;What does this mean?&lt;/p&gt;
&lt;p&gt;Warning: mail() expects parameter 1 to be string, array given in D:\Hosting\7000100\html\gmsngrqst.php on line 69&lt;br /&gt;
There was an error sending the mail&lt;/p&gt;
&lt;p&gt;Line 69 is the start of your suggested code. Is there an easier (yet safe) way I can get this form mailer to work?&lt;/p&gt;
 </description>
     <pubDate>Tue, 15 May 2012 23:23:55 +0000</pubDate>
 <dc:creator>TigerPrincess</dc:creator>
 <guid isPermaLink="false">comment 1275402 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>Hi, assuming that you did set</title>
    <link>https://www.webmaster-forums.net/web-programming-and-application-development/php-form-help#comment-1275363</link>
    <description> &lt;p&gt;Hi, assuming that you did set the $email_to correct, then it looks like it should work correctly.&lt;/p&gt;
&lt;p&gt;Have you checked to see if it ended up in spam/junk folder&lt;/p&gt;
&lt;p&gt;Also, a note on this line:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;@mail($email_to, $email_subject, $email_message, $headers); &lt;/code&gt;&lt;/p&gt;
&lt;p&gt;There are very limited times where using the @ to suppress errors is valid programming technique. All other errors it is a crutch (ie. instead of properly programming to handle things, lets tell PHP to shut up when it complains)&lt;/p&gt;
&lt;p&gt;This code just assumes everything was fine and dandy, try this instead so you know if the mail function even worked:&lt;/p&gt;
&lt;p&gt;&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;if (!mail($email_to, $email_subject, $email_message, $headers)) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; die (&amp;quot;There was an error sending the mail&amp;quot;);&lt;br /&gt;}&lt;/code&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;If this error shows up, then you need to double check all your values you are passing to the mail function. if not then you need to check the junk/spam handling on your e-mails. Beyond that, would require some more in depth checking, that depending on setup, may not be able to do (ie. on my server, i would watch the mail logs to see if it actually sent out and see what result the receiving mail server gave.&lt;/p&gt;
&lt;p&gt;-Greg&lt;/p&gt;
 </description>
     <pubDate>Mon, 14 May 2012 01:56:12 +0000</pubDate>
 <dc:creator>Greg K</dc:creator>
 <guid isPermaLink="false">comment 1275363 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>I tried my form, again and</title>
    <link>https://www.webmaster-forums.net/web-programming-and-application-development/php-form-help#comment-1275358</link>
    <description> &lt;p&gt;I tried my form, again and ran across more errors (lines 72 and 74) and removed:&lt;/p&gt;
&lt;p&gt;&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;&amp;lt;!-- include your own success html here --&amp;gt;&lt;br /&gt;&lt;br /&gt;Thank you for your request!&lt;/code&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;I also added in a redirect, which seems to work &lt;img src=&quot;https://www.webmaster-forums.net/misc/smileys/smile.png&quot; title=&quot;Smiling&quot; alt=&quot;Smiling&quot; class=&quot;smiley-content&quot; /&gt; My new problem is that I am not receiving any test submissions from the website (how frustrating). What is wrong with this code?&lt;/p&gt;
&lt;p&gt;&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // EDIT THE 2 LINES BELOW AS REQUIRED&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $email_to = array(&amp;quot;username@qwestoffice.net&amp;quot;,&amp;quot;username@yahoo.com&amp;quot;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $email_subject = &amp;quot;website.com Song Request&amp;quot;;&lt;/code&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;Any extra help on this matter would be MUCH appreciated!&lt;/p&gt;
&lt;p&gt;Thank you!&lt;br /&gt;
TigerPrincess&lt;/p&gt;
 </description>
     <pubDate>Sun, 13 May 2012 02:39:16 +0000</pubDate>
 <dc:creator>TigerPrincess</dc:creator>
 <guid isPermaLink="false">comment 1275358 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>I just wanted to add a little</title>
    <link>https://www.webmaster-forums.net/web-programming-and-application-development/php-form-help#comment-1275357</link>
    <description> &lt;p&gt;I just wanted to add a little thank you message as I had not found any help on this issue (and had given up on any). Thank you SO MUCH for your help! I am very excited to try this change. &lt;img src=&quot;https://www.webmaster-forums.net/misc/smileys/smile.png&quot; title=&quot;Smiling&quot; alt=&quot;Smiling&quot; class=&quot;smiley-content&quot; /&gt;&lt;/p&gt;
&lt;p&gt;TigerPrincess&lt;/p&gt;
 </description>
     <pubDate>Sat, 12 May 2012 15:38:36 +0000</pubDate>
 <dc:creator>TigerPrincess</dc:creator>
 <guid isPermaLink="false">comment 1275357 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>I know this is an older post,</title>
    <link>https://www.webmaster-forums.net/web-programming-and-application-development/php-form-help#comment-1275353</link>
    <description> &lt;p&gt;I know this is an older post, and you may have found another solution, but for anyone interested the problem was on line #38 (based upon how it was pasted here):&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;$string_exp = &quot;/^[A-Za-z .&#039;-];&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;You are missing the closing quote, as well as the closing / to border the expression. [Edit: actually I followed the link to the tutorial you got this from, and there was even more missing from their example, here it is:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;$string_exp = &quot;/^[A-Za-z .&#039;-]+$/&quot;;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;If you look at how the code is formatted above, you will see on the line right after it, the &lt;strong&gt;if(!preg_match(&lt;/strong&gt; is highlighted the same all text literals in the code before this point, giving a good clue as to where the error is. &lt;/p&gt;
&lt;p&gt;This is where a good IDE that does syntax highlighting is very helpful.  (myself, I use PhpED, but I program in PHP for a living, so it is worth the cost to me)&lt;/p&gt;
&lt;p&gt;-Greg&lt;/p&gt;
 </description>
     <pubDate>Sat, 12 May 2012 05:43:00 +0000</pubDate>
 <dc:creator>Greg K</dc:creator>
 <guid isPermaLink="false">comment 1275353 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>It also doesn&#039;t pass this</title>
    <link>https://www.webmaster-forums.net/web-programming-and-application-development/php-form-help#comment-1270825</link>
    <description> &lt;p&gt;It also doesn&#039;t pass this checker:&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://www.piliapp.com/php-syntax-check/&quot; title=&quot;http://www.piliapp.com/php-syntax-check/&quot;&gt;http://www.piliapp.com/php-syntax-check/&lt;/a&gt;&lt;/p&gt;
 </description>
     <pubDate>Thu, 01 Dec 2011 04:08:21 +0000</pubDate>
 <dc:creator>TigerPrincess</dc:creator>
 <guid isPermaLink="false">comment 1270825 at https://www.webmaster-forums.net</guid>
  </item>
  </channel>
</rss>
