Jump to content

Troublefinder not working


svenjcvd

Recommended Posts

I got some problems with my trouble finder.. I'm trying to find my error's this way...

My contact form is almost finished i guess,

 

i think the only problems 're :

* the missing checkbox variables, because i don't know how to place them. They need to be placed between line 38 and 44 i suppose. I guess with <input type="checkbox" ?

 

* I'm not sure the $mail_body's 're correct to... "he's not checking if all the textfields are filled, only a couple

 

* And the <form action= (on line 55) is wrong to... Im testing the script with XAMPP wamp server, so im not sure how to solve this...

 

Please help me ! !

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>PHP contact</title>
</head>

<body>
<?php
ini_set('display_errors', 'On');
error_reporting(E_ALL | E_STRICT);
if($_SERVER['REQUEST_METHOD']=="POST")
{ 
if(strlen($_POST['voorletters']) ==0)
    { $error_msg ="- Voorletters.<br>"; } 
if(strlen($_POST['naam']) ==0)
    { $error_msg ="- Achternaam.<br>"; } 
if(strlen($_POST['tel']) ==0)
    { $error_msg ="- Telefoonnummer.<br>"; } 
if(!preg_match("/^[_a-zA-Z0-9-]+(\.[*@([a-zA-Z0-9-]+)*@([a-zA-Z0-9-]+\.)+([a-zA-Z]{2,4})$/", $_POST['uwemail']))
    { $error_msg .="- E-mailadres.<br>"; } 
if(strlen($_POST['field']) ==0)
    { $error_msg .="- Vraag.<br>"; } 
    
if(!empty($error_msg))
    { 
    //Een van de velden werd niet goed ingevuld 
    echo "<center><b>Het formulier kan niet worden verzonden...<BR> 
Onderstaande gegevens zijn 'niet', of 'niet correct' ingevuld:</b><br><br>"; 
    echo $error_msg; 
    echo "<br>Probeer het <a href=javascript:history.back(1)>hier</a> opnieuw en vul alstublieft alle velden in.<br><br></center>"; 
    }
else 
    { 
    $recipient = "[email protected]"; //Het email adres van de Ontvanger. 
    $subject = $_POST['Formulier ingevuld']; //Onderwerp van de mail. 
    $header = "From: " . $_POST['uwemail'] . "\n"; 
    $mail_body = "Contact script werd op " . date("d-m-Y") . " om " . date("H:i") . " uur uitgevoerd.\n"; 
    $mail_body .= "De volgende persoon vulde het contact formulier in:\n\n"; 
    $mail_body .= "Naam: " . $_POST['voorletters'] . "\n"; 
    $mail_body .= "E-mailadres: " . $_POST['uwemail'] . "\n\n"; 
    $mail_body .= "Bericht:\n"; 
    $mail_body .= $_POST['field']; 
    $mail_body .= "\n\n -- Einde van het contact bericht --"; 
    mail($recipient, $subject, $mail_body, $header); 
    echo "<center><b>Bedankt voor uw reactie.</b><br><br>Wij zullen zo snel mogelijk contact met u opnemen.<br>
Met vriendelijke groet,<br> JPS</b><br><br><br>"; 
    echo "Terug naar het <a class=\"main\" href='javascript:history.back(1)'>formulier</a></center>"; 
    }
} 
else 
{ 
?> 

<form action="<? echo $_SERVER['file:///Applications/XAMPP/xamppfiles/htdocs']; ?>" method="POST" name="contact"> 
  <table width="100%" border="0" cellspacing="0" cellpadding="0"> 
    <tr> 
      <td><br> 
        <table width="441" height="366" border="0" align="center" cellpadding="0" cellspacing="5" bordercolor="#FFFFFF" bgcolor="#000000"> 
          <tr> 
            <td height="2" colspan="3"><div align="center"><font color="#FFFF00" size="2">Contactformulier</font><br />  
                <br />
            </div>
            <div align="left"></div>              
            <div align="right"><font color="#FFFF00" size="1">(* verplichte velden)</font></div></td> 
          </tr> 
          <tr> 
            <td height="20" rowspan="2"><div align="left"></div></td> 
            <td width="72" height="7"><div align="left"><font color="#FFFF00" size="1">Voorletters *</font></div></td>
            <td height="-4">              
              <div align="left">
                <input name="voorletters" type="text" size="10" />
              </div>
            <div align="right"></div>            <div align="right"></div></td> 
          </tr>
          <tr>
            <td height="8"><font color="#FFFF00" size="1">Achternaam *</font></td>
            <td height="0"><input name="naam" type="text" id="naam" size="30" name:"naam" /></td>
          </tr>
          <tr>
            <td height="0"><div align="left"><font size="2"><font color="#FFFF00"></font></font></div></td>
            <td height="0"><div align="left"><font color="#FFFF00" size="1">Adres</font></div></td>
            <td height="1">              
              <div align="left">
                <input type="text" name="adres" size="30" maxlength="40" />
              </div></td>
          </tr>
          <tr>
            <td height="20" rowspan="2"><div align="left"><font size="2"><font color="#FFFF00"></font></font></div></td>
            <td height="7"><div align="left"><font color="#FFFF00" size="1">Postcode</font></div></td>
            <td height="-4">
              
              <div align="left">
                <input name="postcode" type="text" size="10" maxlength="7" />
              </div>
            <div align="right"></div>            <div align="center"></div>
              
              <div align="left"></div></td>
          </tr>
          <tr>
            <td height="8"><font color="#FFFF00" size="1"> Plaats</font></td>
            <td height="0"><input name="plaats" type="text" id="plaats" size="30" maxlength="40" /></td>
          </tr>
          <tr>
            <td height="1"> </td>
            <td height="1"> <div align="left"><font color="#FFFF00" size="1">Tel *</font></div></td>
            <td height="1"><input type="text" name="tel" size="30" maxlength="15" /></td>
          </tr> 
          <tr> 
            <td width="6" rowspan="2" class="Kleiner"> <div align="left"><font size="2"><font color="#FFFF00"></font></font></div></td> 
            <td class="Kleiner"><div align="left"><font color="#FFFF00" size="1">Email *</font></div></td>
            <td height="-2">              
              <div align="left">
                <input name="uwemail" type="text" size="40" maxlength="40" />
              </div></td> 
          </tr>
          <tr>
            <td class="Kleiner"><div align="left"><font color="#FFFF00" size="1">Onderwerp</font></div></td>
            <td height="-2"><input name="sub" type="text" size="40" maxlength="40" /></td>
          </tr> 
          <tr> 
            <td width="6" class="Kleiner"> </td> 
            <td class="Kleiner"><div align="left"><font color="#FFFF00" size="1">Vraag *</font></div></td>
            <td rowspan="2">              
              
              <div align="left">
                <textarea name="field" cols="40" rows="2" wrap="virtual"></textarea>
              </div></td> 
          </tr> 
          <tr> 
            <td height="15" colspan="2" class="Kleiner"><div align="left"></div></td> 
          </tr> 
          <tr> 
            <td valign="top">              
              <div align="right"></div></td> 
            <td valign="top"><div align="left"><font color="#FFFF00" size="1">Interesses</font></div></td>
            <td height="95">
              <div align="left">
                <label>
                <input type="checkbox" name="interesses" id="interesses" />
                <font color="#FFFF00" size="2">                <font size="1">Keukens</font></font></label>
                <font color="#FFFF00" size="1"><br />
                <label>
                <input type="checkbox" name="interesses3" id="interesses3" />
                Badkamermeubels</label>
                <br />
                <label>
              <input name="interesses2" type="checkbox" id="interesses2" value="kasten" />
              Kasten</label>
                <br />
                <label>
              <input type="checkbox" name="interesses4" id="interesses4" />
              Kantoor</label>
                <br />
                <label>
              <input type="checkbox" name="interesses5" id="interesses5" />
              Tafels</label>
                </font><br />
            </div></td></tr>
          <tr>
            <td colspan="2"> </td>
            <td height="8"><div align="right">
              <input type="reset" name="reset" id="reset" value="Herstel" />
              <input type="Submit" name="Submit" value="Verzenden" />
            </div></td>
          </tr> 
        </table> 
        <table width="100%" border="0" cellspacing="0" cellpadding="0" height="100%"> 
          <tr> 
            <td> </td> 
          </tr> 
        </table> 
      </td> 
    </tr> 
  </table> 
</form> 

<?php 
} 
?>
</body>
</html>

 

Link to comment
https://forums.phpfreaks.com/topic/227864-troublefinder-not-working/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.