PHP contactformulier error

Status
Niet open voor verdere reacties.

Ladyke

Gebruiker
Lid geworden
9 okt 2010
Berichten
671
hoi,

ik ben bezig met mijn eigen website te maken, ik ben bezig met een contacpagina (contactformulier).
nu ik ben niet zo weg met php maar leer het stapvoets.
nu heb ik dit formulier geintegreerd in mijn website maar om een of andere reden geeft de code een error. en kan er niet aan uit waarom.

De webpagina :
HTML:
<!DOCTYPE html>
<!--[if lt IE 7 ]> <html class="ie ie6 no-js" lang="en"> <![endif]-->
<!--[if IE 7 ]>    <html class="ie ie7 no-js" lang="en"> <![endif]-->
<!--[if IE 8 ]>    <html class="ie ie8 no-js" lang="en"> <![endif]-->
<!--[if IE 9 ]>    <html class="ie ie9 no-js" lang="en"> <![endif]-->
<!--[if gt IE 9]><!--><html class="no-js" lang="en"><!--<![endif]-->
    <head>
        <meta charset="UTF-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> 
        <title>Bjorn Mertens</title>
        <meta name="viewport" content="width=device-width, initial-scale=1.0"> 
        <meta name="description" content="Fullscreen Background Image Slideshow with CSS3 - A Css-only fullscreen background image slideshow" />
        <meta name="keywords" content="css3, css-only, fullscreen, background, slideshow, images, content" />
        <meta name="author" content="Codrops" />
        <link rel="shortcut icon" href="../favicon.ico"> 
        <link rel="stylesheet" type="text/css" href="css/demo_index.css" />
        <link rel="stylesheet" type="text/css" href="css/style1_index.css" />
		<script type="text/javascript" src="js/modernizr.custom.86080.js"></script>
       <script src="js/freecontactformvalidation.js"></script>
	<script>
	required.add('Full_Name','NOT_EMPTY','Full Name');
	required.add('Email_Address','EMAIL','Email Address');
	required.add('Your_Message','NOT_EMPTY','Your Message');
	required.add('AntiSpam','NOT_EMPTY','Anti-Spam Question');
	</script>
	<link rel="stylesheet" type="text/css" href="css/freecontactform.css">
    </head>
    <body id="page">
        <ul class="cb-slideshow">
            <li><span>Image 01</span><div><h3>Bjorn Mertens</h3></div></li>
            <li><span>Image 02</span><div><h3>Bjorn Mertens</h3></div></li>
            <li><span>Image 03</span><div><h3>Bjorn Mertens</h3></div></li>
            <li><span>Image 04</span><div><h3>Bjorn Mertens</h3></div></li>
            <li><span>Image 05</span><div><h3>Bjorn Mertens</h3></div></li>
            <li><span>Image 06</span><div><h3>Bjorn Mertens</h3></div></li>
        </ul>
        <div class="container">
            <!-- Codrops top bar -->
            <div class="codrops-top">
                    <a class="index" href="index.html"><strong>Home</strong></a>
                    <a class="index" href="images_overview.html"><strong>Photography</strong></a>
                    <a class="index" href="contact.html"><strong>Contact</strong></a>
                    <a class="index" href="donate.html"><strong>Donate</strong></a>
         <span class="right">
                <a class="index" href="http://www.flickr.com/photos/markjsebastian/" target="_blank">Photography by Bjorn Mertens</a>
            </span>
              <div class="clr">
                </div>
            </div><!--/ Codrops top bar --></div>
                          <div class="content">
                         <form name="freecontactform" method="post" action="PHP/freecontactformprocess.php" onsubmit="return validate.check(this)">
	<table width="400px" class="freecontactform">
	<tr>
	 <td colspan="2">
	  
	 <div class="freecontactformheader">Contact me</div>
	  
	 <div class="freecontactformmessage">Fields marked with <span class="required_star"> * </span> are mandatory.</div>
	  
	 </td>
	</tr>
	<tr>
	 <td valign="top">
	  <label for="Full_Name" class="required">Full Name<span class="required_star"> * </span></label>
	 </td>
	 <td valign="top">
	  <input type="text" name="Full_Name" id="Full_Name" maxlength="80" style="width:230px">
	 </td>
	</tr>
	<tr>
	 <td valign="top">
	  <label for="Email_Address" class="required">Email Address<span class="required_star"> * </span></label>
	 </td>
	 <td valign="top">
	  <input type="text" name="Email_Address" id="Email_Address" maxlength="100" style="width:230px">
	 </td>
	</tr>
	<tr>
	 <td valign="top">
	  <label for="Your_Message" class="required">Message<span class="required_star"> * </span></label>
	 </td>
	 <td valign="top">
	  <textarea style="width:230px;height:160px" name="Your_Message" id="Your_Message" maxlength="2000"></textarea>
	 </td>
	</tr>
	<tr>
	 <td colspan="2" style="text-align:center" >
	  <div class="antispammessage">
	  To help prevent automated spam, please answer this question
	  <br /><br />
		  <div class="antispamquestion">
		   <span class="required_star"> * </span>
		   Using only numbers, what is 10 plus 15? &nbsp; 
		   <input type="text" name="AntiSpam" id="AntiSpam" maxlength="100" style="width:30px">
		  </div>
	  </div>
	 </td>
	</tr>
	<tr>
	 <td colspan="2" style="text-align:center" ><p>&nbsp;
	   </p>
	   <p>
	     <input type="submit" value=" Submit Form " style="width:200px;height:40px">
	     <br /><br />
	     <!-- 
	  If you want to remove this author link, 
	  please purchase an unbranded version from: http://www.freecontactform.com/unbranded_form.php 
	  Or upgrade to the professional version at: http://www.freecontactform.com/professional.php
	  -->
	     </p>
	   <div>
	     <p>Form provided by: <a href="http://www.freecontactform.com">FreeContactForm.com</a><br />
	       </p>
	   </div></td>
	</tr>
	</table>
	</form>
                      </div>
    </body>
</html>

Php Processor:

Code:
<?php
/**
 * 
 * URL: www.freecontactform.com
 * 
 * Version: FreeContactForm Free V2.2
 * 
 * Copyright (c) 2013 Stuart Cochrane
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 * 
 * 
 * Note: This is NOT the same code as the PRO version
 * 
 */

if(isset($_POST['Email_Address'])) {
	
	include 'freecontactformsettings.php';
	
	function died($error) {
		echo "Sorry, but there were error(s) found with the form you submitted. ";
		echo "These errors appear below.<br /><br />";
		echo $error."<br /><br />";
		echo "Please go back and fix these errors.<br /><br />";
		die();
	}
	
	if(!isset($_POST['Full_Name']) ||
		!isset($_POST['Email_Address']) ||
		!isset($_POST['Telephone_Number']) ||
		!isset($_POST['Your_Message']) || 
		!isset($_POST['AntiSpam'])		
		) {
		died('Sorry, there appears to be a problem with your form submission.');		
	}
	
	$full_name = $_POST['Full_Name']; // required
	$email_from = $_POST['Email_Address']; // required
	$telephone = $_POST['Telephone_Number']; // not required
	$comments = $_POST['Your_Message']; // required
	$antispam = $_POST['AntiSpam']; // required
	
	$error_message = "";
	
	$email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/';
  if(preg_match($email_exp,$email_from)==0) {
  	$error_message .= 'The Email Address you entered does not appear to be valid.<br />';
  }
  if(strlen($full_name) < 2) {
  	$error_message .= 'Your Name does not appear to be valid.<br />';
  }
  if(strlen($comments) < 2) {
  	$error_message .= 'The Comments you entered do not appear to be valid.<br />';
  }
  
  if($antispam <> $antispam_answer) {
	$error_message .= 'The Anti-Spam answer you entered is not correct.<br />';
  }
  
  if(strlen($error_message) > 0) {
  	died($error_message);
  }
	$email_message = "Form details below.\r\n";
	
	function clean_string($string) {
	  $bad = array("content-type","bcc:","to:","cc:");
	  return str_replace($bad,"",$string);
	}
	
	$email_message .= "Full Name: ".clean_string($full_name)."\r\n";
	$email_message .= "Email: ".clean_string($email_from)."\r\n";
	$email_message .= "Telephone: ".clean_string($telephone)."\r\n";
	$email_message .= "Message: ".clean_string($comments)."\r\n";
	
$headers = 'From: '.$email_from."\r\n".
'Reply-To: '.$email_from."\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($email_to, $email_subject, $email_message, $headers);
header("Location: $thankyou");
?>
<script>location.replace('<?php echo $thankyou;?>')</script>
<?php
}
die();
?>

Php settings :
Code:
<?php

$email_to = "MIJN EMAIL"; // your email address
$email_subject = "Contact website"; // email subject line


// if you update the question on the form -
// you need to update the questions answer below
$antispam_answer = "25";

?>

Mijn email inde laatste php heb ik ingevuld maar verwijderd voor op het forum te zetten ;)
kan iemand mij proberen te helpen wat het probleem is ?

Thanks
Ladyke
 
Ik hoop niet dat je er van uit gaat dat we uit ons hoofd weten welke foutmelding jij krijgt te zien. Voor die situaties verwijzen wij altijd naar het helderziendenforum elders op internet. :)

Oftewel, zou je kunnen vermelden welke foutmelding je krijgt.
 
ik kreeg gewoon een error er is een fout gevonden in het formulier, controleer formulier, alle verplichte velden zijn ingevuld. momenteel krijg ik niets te zien enkel een wit beeld nadat ik op verwenden drukte word de processor geladen en komt dit in de browserbalk : http://192.168.1.200/PHP/freecontactformprocess.php
voor de rest niets
 
ik heb de instellingen in mijn php.ini file aangepast met VI, pche gerestart en geeft nog steeds een wit beeld
 
Dat is dus niet gewoon een foutmelding. Deze is belangrijk. Vergelijk de exacte foutmeldingstekst eens met de teksten in de code. Dat geeft in ieder geval een aanwezing in welk stuk code het fout gaat.
 
Heeft de witte pagina überhaupt een bron? (CTRL+U)
 
Status
Niet open voor verdere reacties.
Terug
Bovenaan Onderaan