Hey all, I am just learning PHP and have pieced this code together, but I cannot get it to work.
Anyone have an idea on why?
First file is the file contact page.

<html> 

<head> 
<title>RT Photography-Contact Page)</title> 
<style> 
BODY{font-size: 8pt; font-family: Verdana
} 
.button {background-color: rgb(128,128,128); color:#ffffff; font-size: 8pt;} 
.inputc {font-size: 8pt;} 
a {
    color: #FFFFFF;
}
a:visited {
    color: #FFFFFF;
}
a:active {
    color: #FFFFFF;
}
a:hover {
    color: #FFFFFF;
}
.style1 {
    background-color: #800080;
    background-image: url('../Test Site-3-File upload/semi-black-background.jpg');
}
.style2 {
    border-width: 0px;
}
</style> 
</head> 

<body style="color: #FFFFFF; background-image: url('../Test Site-3-File upload/semi-black-background.jpg')"> 

<form name="phpformmailer" action="../Test Site-3-File upload/contact_process.php" align="center" method="post"><form action="contact_process.php" method="post" enctype="multipart/form-data">
          <p> 
  <div align="center"><center><br><br>
<br>
      <table width="742" cellspacing="6" class="style1"> 
    <tr> 
      <td style="width: 328px">Princess for Prom 2010</td> 
      <td width="556"><a href="http://www.imagesnwords.com/">Rick Terpstra Photography</a></td> 
    </tr> 
    <tr> 
      <td align="right" style="width: 328px"><small>Your name:</small></td> 
      <td width="556"><font face="Arial"> 
      <input class="inputc" size="50" name="name"> 
      <input type="hidden" name="block_spam_bots" value="1"> 
      </font></td> 
    </tr> 
    <tr> 
      <td align="right" style="width: 328px"><font color="#000080" size="1">*</font><small> Your email 
      address:</small></td> 
      <td align="left" width="556"><font face="Arial"><input class="inputc" size="50" 
      name="email"> 
      </font></td> 
    </tr> 
    <tr align="middle"> 
      <td align="right" style="width: 328px"><font color="#000080" size="1">*</font><small> Confirm email 
      address:</small></td> 
      <td width="556" align="left"><font face="Arial"><input class="inputc" size="50" 
      name="email2"> 
      </font></td> 
    </tr> 
    <tr> 
      <td align="right" style="width: 328px"><font color="#000080" size="1">*</font><small> Subject:</small></td> 
      <td width="556"><font face="Arial"><input class="inputc" size="60" name="thesubject"> 
      </font></td> 
    </tr> 
    <tr> 
      <td align="right" style="width: 328px">&nbsp; 
        <p><font color="#000080" size="1">*</font><small> Your 
      request or query:</small></td> 
      <td width="556"><p>
        <textarea style="FONT-SIZE: 10pt" name="themessage" rows="7" cols="60"></textarea>
      </p>
      <p>Send these files:<br />
            <input name="userfile[]" type="file" /><br />
            <input name="userfile[]" type="file" /><br />
            <input type="submit" value="Send files" />
          </p>
        </form>
<tr>
  <td style="width: 328px"></td> 
  <td width="556"><p>&nbsp;</p>
    </form>
<script language="JavaScript"><!-- 
function validateForm()  
{ 
 var okSoFar=true 
 with (document.phpformmailer) 
 { 
  var foundAt = email.value.indexOf("@",0) 
  if (foundAt < 1 && okSoFar) 
  { 
    okSoFar = false 
    alert ("Please enter a valid email address.") 
    email.focus() 
  } 
  var e1 = email.value 
  var e2 = email2.value 
  if (!(e1==e2) && okSoFar) 
  { 
    okSoFar = false 
    alert ("Email addresses you entered do not match.  Please re-enter.") 
    email.focus() 
  } 
  if (thesubject.value=="" && okSoFar) 
  { 
    okSoFar=false 
    alert("Please enter the subject.") 
    thesubject.focus() 
  } 
  if (themessage.value=="" && okSoFar) 
  { 
    okSoFar=false 
    alert("Please enter the details for your enquiry.") 
    themessage.focus() 
  } 
  if (okSoFar==true)   
  { 
   block_spam_bots.value=4*3;//spam bots currently can not read JavaScript, if could then they'd fail the maths! 
   submit();                  // do check for updatea often at:  [url]www.TheDemoSite.co.uk[/url]  
  }  
 } 
} 
// --></script>
</body> 
</html> 

And the return page is-

<?php 
/* PHP Form Mailer - phpFormMailer v2.5, last updated 21st Sept 2009 - check back often for updates! 
     (easy to use and more secure than many cgi form mailers) FREE from: 

                  [url]www.TheDemoSite.co.uk[/url] 

      Should work fine on most Unix/Linux platforms 
      for a Windows version see: asp.thedemosite.co.uk 
*/ 

// ------- three variables you MUST change below  ------------------------------------------------------- 
$replyemail="info@imagesnwords.com"; //change to your email address 
$valid_ref1="http://ourmarriagecanada.com/contact.html"; //chamge to your domain name 
$valid_ref2="http://ourmarriagecanada.com/contact.html"; //chamge to your domain name 

// -------- No changes required below here ------------------------------------------------------------- 
// 
// email variable not set - load $valid_ref1 page 
if (!isset($_POST['email'])) 
{ 
 echo "<script language=\"JavaScript\"><!--\n "; 
 echo "top.location.href = \"$valid_ref1\"; \n// --></script>"; 
 exit; 
} 
$ref_page=$_SERVER["HTTP_REFERER"]; 
$valid_referrer=0; 
if($ref_page==$valid_ref1) $valid_referrer=1; 
elseif($ref_page==$valid_ref2) $valid_referrer=1; 
if((!$valid_referrer) OR ($_POST["block_spam_bots"]!=12))//you can change this but remember to change it in the contact form too 
{ 
 echo '<h2>ERROR - not sent.'; 
 if (file_exists("debug.flag")) echo '<hr>"$valid_ref1" and "$valid_ref2" are incorrect within the file:<br> 
                                      contact_process.php <br><br>On your system these should be set to: <blockquote> 
                                      $valid_ref1="'.str_replace("www.","",$ref_page).'"; <br> 
                                      $valid_ref2="'.$ref_page.'"; 
                                      </blockquote></h2>Copy and paste the two lines above  
                                      into the file: contact_process.php <br> (replacing the existing variables and settings)'; 
 exit; 
} 

//check user input for possible header injection attempts! 
function is_forbidden($str,$check_all_patterns = true) 
{ 
 $patterns[0] = 'content-type:'; 
 $patterns[1] = 'mime-version'; 
 $patterns[2] = 'multipart/mixed'; 
 $patterns[3] = 'Content-Transfer-Encoding'; 
 $patterns[4] = 'to:'; 
 $patterns[5] = 'cc:'; 
 $patterns[6] = 'bcc:'; 
 $forbidden = 0; 
 for ($i=0; $i<count($patterns); $i++) 
  { 
   $forbidden = eregi($patterns[$i], strtolower($str)); 
   if ($forbidden) break; 
  } 
 //check for line breaks if checking all patterns 
 if ($check_all_patterns AND !$forbidden) $forbidden = preg_match("/(%0a|%0d|\\n+|\\r+)/i", $str); 
 if ($forbidden) 
 { 
  echo "<font color=red><center><h3>STOP! Message not sent.</font></h3><br><b> 
        The text you entered is forbidden, it includes one or more of the following: 
        <br><textarea rows=9 cols=25>"; 
  foreach ($patterns as $key => $value) echo $value."\n"; 
  echo "\\n\n\\r</textarea><br>Click back on your browser, remove the above characters and try again. 
        </b><br><br><br><br>Thankfully protected by phpFormMailer freely available from: 
        <a href=\"http://thedemosite.co.uk/phpformmailer/\">http://thedemosite.co.uk/phpformmailer/</a>"; 
  exit(); 
 } 
} 

foreach ($_REQUEST as $key => $value) //check all input  
{ 
 if ($key == "themessage") is_forbidden($value, false); //check input except for line breaks 
 else is_forbidden($value);//check all 
} 

$name = $_POST["name"]; 
$email = $_POST["email"]; 
$thesubject = $_POST["thesubject"]; 
$themessage = $_POST["themessage"]; 

$success_sent_msg='<p align="center"><strong>&nbsp;</strong></p> 
                   <p align="center"><strong>Your message has been successfully sent to us<br> 
                   </strong> and we will reply as soon as possible.</p>
                   <p align="center">A copy of your query has been sent to you.</p> 
                   <p align="center"> <a href="http://www.imagesnwords.com">Rick Terpstra Photography</a>   
                   <p align="center">Thank you for contacting us.</p>'; 

$replymessage = "Hi $name 

Thank you for your email. 

We will endeavour to reply to you shortly. 

Below is a copy of the message you submitted: 

-------------------------------------------------- 
Subject: $thesubject 
Query: 
$themessage 
-------------------------------------------------- 

Thank you"; 

$themessage = "name: $name \nQuery: $themessage"; 
mail("$replyemail", 
     "$thesubject", 
     "$themessage", 
     "From: $email\nReply-To: $email"); 
mail("$email", 
     "Receipt: $thesubject", 
     "$replymessage", 
     "From: $replyemail\nReply-To: $replyemail"); 
echo $success_sent_msg; 
/* 
    [url]www.imagesnwords.com[/url]       */ 
?>  

Thanks all

#1) edit that post and use code=php tags

#2) "it works" doesnt give anyone much to go off of. what doesnt work? is an error printed? Hard to make a pizza if you don't know what toppings are supposed tobe on it.

#3) I'll take a stab and say that since the script you downloaded is amailer, that the mail isnt going through. the most common cause of no mail is that the server you are running the script on doesnt have smtp set up. search around here. about every 15-25 posts in this forum is someone not having smtp set up

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.