Hi all!
I'm pretty green on this and i'm trying to create a form that sends a authorization
mail
using a few variable using the ()mail script.
I have all settings correct, added the smtp right, even tested it with the following
script wich worked fine....
"<?php
print mail ('[EMAIL PROTECTED]',
'No need for reply -- PHP test!', /* subject */
"hi Cheyenne\nLine 2\n"); /* body */
?>"
When using the concerning script wich i copied below, it just doesnt send the mail and
gives me the following error : "Warning: Server Error in x:\apache
group\apache\htdocs\php-pages\register.php on line 103"
It does in fact store the submitted data in the database so it is only the mail that's
given
me a headache!!! What is it i'm doing wrong? (i've put the 'error-line' 103 in
bold/italic)
The source:
<html>
<head>
<title>Inschrijven</title>
</head>
<body>
<p align="left">
<?
require "../db.php";
require "../functions.inc.php";
$result=mysql_query("SELECT * FROM CATEGORIE");
$result2=mysql_query("SELECT * FROM CATEGORIE");
$result3=mysql_query("SELECT * FROM CATEGORIE");
?>
<?php
if ($submit)
{
$geboortedatum=$jaar."-".$maand."-".$dag;
$van=$jaar2."-".$maand2."-".$dag2;
$tot=$jaar3."-".$maand3."-".$dag3;
$postcode=$postcode1.$postcode2;
for ($ix=0;$ix<count($rijbewijs);$ix++)
{
$rijbewijzen.=$rijbewijs[$ix]." ";
}
if (emailcheck($email)!="oke")
{
$fout.="Vul een geldig e-mailadres in.<br>";
}
if (strlen($ervaring)==0)
{
$fout.="Vul een geldige waarde in voor <b>ervaring</b>.<br>";
}
if (strlen($nationaliteit)==0)
{
$fout.="Vul een geldige waarde in voor <b>nationaliteit</b>.<br>";
}
if (strlen($naam)==0)
{
$fout.="Vul een geldige naam in.<br>";
}
if (strlen($voornaam)==0)
{
$fout.="Vul een geldige voornaam in.<br>";
}
if (strlen($adres)<7)
{
$fout.="Vul een geldig adres in.<br>";
}
if (strlen($postcode)!=6)
{
$fout.="Vul een geldige postcode in.<br>";
}
if (strlen($plaats)<5)
{
$fout.="Vul een geldige woonplaats in.<br>";
}
if (strlen($tel)<10 || strlen($mobiel)<10)
{
$fout.="Een telefoonnummer bestaat uit minimaal 10 cijfers.<br>";
}
if ($fout)
{
$fout.="<br>Klik <a href=javascript:history.go(-1)>hier</a> om de invoer te
verbeteren.";
echo "<h1>FOUTE INVOER</h1>";
echo $fout;
}
else
{
srand((double)microtime()*1000000);
$mailcode= rand(1000,9999);
if ($register=mysql_query("INSERT INTO TEST
VALUES('','$naam','$voornaam','$geslacht','$geboortedatum','$adres','$postcode','$plaats','$tel','$mobiel','$email','$nationaliteit','$opleiding','$rijbewijzen','$cat1','$cat2','$cat3','$van','$tot','$ervaring','$info','$mailcode','0')"))
{
//variabalen declareren voor te versturen verificatie mail
/* recipients */
$recipient.= "$voornaam $naam <$email>" ;
/* subject */
$subject= "E-mail verificatie TEST";
/* message */
$message.= "Beste ". $voornaam.",\n\n" ;
$message.= "Je hebt je ingeschreven op de website van TEST.\n\n";
$message.= "Om je inschrijving definitief te maken klik je op onderstaande
link.\n\n";
$message.= "http://notnamed.com/validate/validate.php?code=".$mailcode."\n\n";
$message.= "Staat je emailprogramma niet toe om email-links te volgen kun je ook de
volgende URL intypen:\n\n";
$message.= "http://notnamed.com/validate/validate.php\n\n";
$message.= "Daar vul je dan de volgende code in:\n".$mailcode."\n\n";
$message.= "Noteer deze persoonlijke code!\n".$mailcode."\n\n";
$message.= "Deze code, samen met je emailadres geeft je de mogelijkheid\n\n";
$message.= "om te reageren op vacatures en je gegevens aan te passen.\n\n";
$message.= "Met vriendelijke groet,\n\TEST";
$headers= "From: [EMAIL PROTECTED]>\n";
$headers.= "X-Mailer: PHP\n"; // mailer
$headers.= "Return-Path: <[EMAIL PROTECTED]>"; // Return path for errors
mail($recipient, $subject, $message, $headers);
echo "Uw gegevens zijn opgeslagen in het systeem.<br>";
echo "U heeft een e-mailbericht ontvangen met daarin verdere instructies om de
inschrijving definitief te maken.<br>";
echo "Pas als u die instructies heeft opgevolgd is uw inschrijving definitief.<br>";
}
else
{
echo "Er ging iets mis bij het invoeren in de database.<br>br>".mysql_error();
}
}
}
else{
?>
</p>
<form method=post action="<?echo $PHP_SELF;?>">
<table border=0 width="461">
<tr>
<td width="127">Naam</td>
<td colspan="3">
<input type=text size=20 name=naam>
</td>
</tr>
<tr>
<td width="127">Voornaam</td>
<td colspan="3">
<input type=text size=20 name=voornaam>
</td>
</tr>
<tr>
<td width="127">Geslacht</td>
<td colspan="3">
<input type=radio name=geslacht value=M checked>
Man
<input type=radio name=geslacht value=V>
Vrouw </td>
</tr>
<tr>
<td width="127">Geboortedatum</td>
<td colspan="3">
<select name=dag>
<?
for ($i=1;$i<32;$i++)
{
?>
<option>
<?echo $i;?>
</option>
<?
}
?>
</select>
<select name=maand>
<?
for ($i=1;$i<13;$i++)
{
?>
<option>
<?echo $i;?>
</option>
<?
}
?>
</select>
<select name=jaar>
<?
for ($i=1940;$i<1999;$i++)
{
?>
<option>
<?echo $i;?>
</option>
<?
}
?>
</select>
</td>
</tr>
<tr>
<td width="127">Adres</td>
<td colspan="3">
<input type=text size=30 name=adres>
</td>
</tr>
<tr>
<td width="127">Postcode</td>
<td colspan="3">
<input type=text size=4 maxlength=4 name=postcode1>
<input type=text size=2 maxlength=2 name=postcode2>
</td>
</tr>
<tr>
<td width="127">Woonplaats</td>
<td colspan="3">
<input type=text size=20 name=plaats>
</td>
</tr>
<tr>
<td width="127">Nationaliteit</td>
<td colspan="3">
<input type=text size=20 name=nationaliteit>
</td>
</tr>
<tr>
<td width="127">Opleiding</td>
<td colspan="3">
<select name=opleiding>
<option>Laag</option>
<option>Midden</option>
<option>Hoog</option>
</select>
</td>
</tr>
<tr>
<td width="127" rowspan="2" valign="top">Rijbewijs</td>
<td colspan="3" valign="top">
<input type=checkbox name=rijbewijs[] value=A>
A
<input type=checkbox name=rijbewijs[] value=B>
B
<input type=checkbox name=rijbewijs[] value=C>
C </td>
</tr>
<tr>
<td valign="top" height="52" width="74">
<input type=checkbox name=rijbewijs[]2 value=D>
D</td>
<td valign="top" height="52" width="36">
<input type=checkbox name=rijbewijs[]22 value=E>
E</td>
<td valign="top" height="52" width="206"><br>
<br>
</td>
</tr>
<tr>
<td width="127">Telefoon</td>
<td colspan="3">
<input type=text size=10 name=tel value="0000000000">
</td>
</tr>
<tr>
<td width="127">Mobiel</td>
<td colspan="3">
<input type=text size=11 name=mobiel value="0000000000">
</td>
</tr>
<tr>
<td width="127">E-mailadres</td>
<td colspan="3">
<input type=text size=20 name=email>
</td>
</tr>
<tr>
<td width="127">Beroepscategorie</td>
<td colspan="3">
<select name=cat1>
<option value=0>-- Keuze 1 --</option>
<?
while ($row=mysql_fetch_array($result))
{?>
<option value="<?echo $row[ID];?>">
<?echo $row[NL];?>
</option>
<?}?>
</select>
<select name=cat2>
<option value=0>-- Keuze 2 --</option>
<?
while ($row2=mysql_fetch_array($result2))
{?>
<option value="<?echo $row2[ID];?>">
<?echo $row2[NL];?>
</option>
<?}?>
</select>
<select name=cat3>
<option value=0>-- Keuze 3 --</option>
<?
while ($row3=mysql_fetch_array($result3))
{?>
<option value="<?echo $row3[ID];?>">
<?echo $row3[NL];?>
</option>
<?}?>
</select>
</td>
</tr>
<tr>
<td width="127">Ervaring</td>
<td colspan="3">
<input type=text size=20 name=ervaring>
</td>
</tr>
<tr>
<td width="127">Beschikbaar</td>
<td colspan="2">van<br>
<br>
tot </td>
<td width="206">
<select name=dag2>
<?
for ($i=1;$i<32;$i++)
{
?>
<option>
<?echo $i;?>
</option>
<?
}
?>
</select>
<select name=maand2>
<?
for ($i=1;$i<13;$i++)
{
?>
<option>
<?echo $i;?>
</option>
<?
}
?>
</select>
<select name=jaar2>
<?
for ($i=2001;$i<2002;$i++)
{
?>
<option>
<?echo $i;?>
</option>
<?
}
?>
</select>
<br>
<select name=dag3>
<?
for ($i=1;$i<32;$i++)
{
?>
<option>
<?echo $i;?>
</option>
<?
}
?>
</select>
<select name=maand3>
<?
for ($i=1;$i<13;$i++)
{
?>
<option>
<?echo $i;?>
</option>
<?
}
?>
</select>
<select name=jaar3>
<?
for ($i=2001;$i<2020;$i++)
{
?>
<option>
<?echo $i;?>
</option>
<?
}
?>
</select>
</td>
</tr>
<tr>
<td width="127">Vink het vakje aan als u nieuws wilt ontvangen.</td>
<td valign=top colspan="3">
<input type=checkbox size=20 name=info value=1>
</td>
</tr>
<tr>
<td width="127">
<input type=submit name=submit value=Inschrijven>
</td>
<td colspan="3">
<input type=reset value=Opnieuw name="reset">
</td>
</tr>
</table>
</form>
<?}?>
<p>
</body>
</html>
Hope anyone can help me out on this one...
Thanks in advance!!
Regards, Cheyenne