Hi,
i'm building a form with php, but i can't get it to work correctly...
Here is the form located...
http://www.typografics.be/SITE2008/form/contact-frame-aanvraag.html
For the checkboxes (drukkerij, reclamebureau,...) i've found on the internet i have to use an array...
This is my html form
<body>
<form name="form2" method="post" action="http://www.stevenaerts.be/Client_forms/Typografics-contact-frame-aanvraag.php">
<span class="formtitel">Doe beroep op het Typografics team</span>
<p class="intxt">Zoekt u tijdelijk een werkkracht voor uw reclamebureau, uitgeverij, drukkerij, fotogravure of bedrijf? <br>
Vul dan snel onderstaand formulier in.</p>
<table width="650" border="0" cellpadding="0" cellspacing="0" class="formtxt" id="tabz">
<tr>
<td width="151">Naam: </td>
<td width="499"><input name="naam" type="text" class="formelement" id="naam" size="70"></td>
</tr>
<tr>
<td>Bedrijf: </td>
<td><input name="bedrijf" type="text" class="formelement" id="bedrijf" size="70"></td>
</tr>
<tr>
<td>Adres: </td>
<td><input name="adres" type="text" class="formelement" id="adres" size="70"></td>
</tr>
<tr>
<td>Postcode: </td>
<td><table width="499" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="72"><input name="post" type="text" class="formelement" id="post" size="8"></td>
<td width="110"> Gemeente: </td>
<td width="317"><input name="gemeente" type="text" class="formelement" id="gemeente" size="51"></td>
</tr>
</table></td>
</tr>
<tr>
<td>Telefoon: </td>
<td><input name="tel" type="text" class="formelement" id="tel" size="70"></td>
</tr>
<tr>
<td>Fax: </td>
<td><input name="fax" type="text" class="formelement" id="fax" size="70"></td>
</tr>
<tr>
<td>E-mail: </td>
<td><input name="email" type="text" class="formelement" id="email" size="70"></td>
</tr>
<tr>
<td>Website: </td>
<td><input name="website" type="text" class="formelement" id="website" size="70"></td>
</tr>
</table>
<br>
<table width="650" border="0" cellpadding="0" cellspacing="0" class="formtxt" id="tabz">
<tr>
<td width="24" align="left" ><input name="bedrijvig[]" type="checkbox" class="formtxt" value="Drukkerij"> </td>
<td width="98" >DRUKKERIJ</td>
<td width="24"><input type="checkbox" name="bedrijvig[]" value="Reclame"></td>
<td width="120">RECLAMEBUREAU</td>
<td width="24" ><input type="checkbox" name="bedrijvig[]" value="Foto-gravure"></td>
<td width="210">FOTO-GRAVURE</td>
</tr>
<tr>
<td height="23" align="left"><input type="checkbox" name="bedrijvig[]" value="Uitgeverij"></td>
<td>UITGEVERIJ</td>
<td colspan="2" align="right">ANDERE:</td>
<td colspan="2"><input name="andere" type="text" class="formelement" id="andere" size="35"></td>
</tr>
</table>
<table width="650" border="0" cellpadding="0" cellspacing="0" class="formtxt" id="tabz">
<tr>
<td height="19" colspan="6" class="formtitel">Bronvermelding</td>
<td width="75" rowspan="4"><INPUT TYPE="image" SRC="../images/verzend.gif" VALUE="Submit now"
ALT="Submit now" NAME="Submit now"> </td>
</tr>
<tr>
<td width="24" align="left"><input type="checkbox" name="bron" value="Zoekmachine"> </td>
<td width="98">ZOEKMACHINE</td>
<td width="24"><input type="checkbox" name="bron" value="Andere website"></td>
<td width="120">ANDERE WEBSITE</td>
<td width="24"><input type="checkbox" name="bron" value="Ander bedrijf"></td>
<td width="135">ANDER BEDRIJF</td>
</tr>
<tr>
<td height="29" align="left"> <input type="checkbox" name="bron" value="Collega"></td>
<td>COLLEGA</td>
<td colspan="2" align="center">ANDERE:</td>
<td colspan="2"><input name="andere2" type="text" class="formelement2" id="andere2" size="20">
</td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
</form>
</body>
Here is the php so far...
<link href="http://www.typografics.be/SITE2008/form/contact-frame-aanvraag.css" rel="stylesheet" type="text/css">
<body class="intxt">
<?php
if (isset($_POST['submit'])) {
$bedrijvig = $_POST["bedrijvig"];
$how_many = count($bedrijvig);
echo 'Soort bedrijf: '.$how_many.'<br><br>';
if ($how_many>0) {
echo 'Bedrijf:<br>';
}
for ($i=0; $i<$how_many; $i++) {
echo ($i+1) . '- ' . $bedrijvig[$i] . '<br>';
}
echo "<br><br>";
}
?>
<?
$naam=$_POST['naam'];
$bedrijf=$_POST['bedrijf'];
$adres=$_POST['adres'];
$post=$_POST['post'];
$gemeente=$_POST['gemeente'];
$tel=$_POST['tel'];
$fax=$_POST['fax'];
$email=$_POST['email'];
$website=$_POST['website'];
$bedrijvig=$_POST['bedrijvig'];
$andere=$_POST['andere'];
$bron=$_POST['bron'];
$andere2=$_POST['andere2'];
if ($naam=="" || $email=="")
{
echo "U heeft niet alle verplichte velden ingevuld,";
echo "<a href='javascript:history.back();' > klik hier om terug te gaan!</a>";
}
else {
//do email format validation
if(!eregi('^([._a-z0-9-]+[._a-z0-9-]*)@(([a-z0-9-]+\.)*([a-z0-9-]+)(\.[a-z]{2,3})?)$', $email)) {
echo "Dit is geen geldig email adres, ";
echo "<a href='javascript:history.back();' style='color: green; text-decoration:underline;'>klik hier om terug te gaan!</a>";
exit;
}
// Ok, now send email
$youremail="stevenaerts@me.com";
$recipient="<$email>\n";
$headers="From:<$email>\n";
$subject="Online contact bericht";
$message="
Wij zoeken een tijdelijke werknemer, gelieve ons zo snel mogelijk te contacteren.
Naam: $naam
Bedrijf: $bedrijf
Adres: $adres
Postcode: $post
Gemeente: $gemeente
Telefoon: $tel
Fax: $fax
Email: $email
Website: $website
Type bedrijf: $bedrijvig
Bronvermelding: $bron
$andere2
";
mail ("$youremail", "$subject", $message, $headers);
mail ("$recipient", "Bedankt voor uw bericht.","Typografics zal met u contact opnemen voor een grondige bespreking van de aanvraag.",$headers);
echo "Bedankt voor uw aanvraag! Typografics zal met u contact opnemen voor een grondige bespreking van de aanvraag.
";
}
?>
</body>
The variable $bedrijvig is the one i'm reffering to...
If a visitor select more then 1 checkbox, i would like to have all the choices sent to my email instead of only the last one....
Can somebody tell me what i'm doing wrong please... I can't seem to find it...
Thx