Hey all,
I have this mail form, with this as php code:
I wish to add an upload function (attachment), like this:Code:<?php if ($_POST["action"] == "send"){ if ($_POST[naam] != " je naam" and $_POST[naam] != "" and $_POST[email] != " je e-mail adres" and $_POST[email] != "" and $_POST[bericht] != "") { mail ("info@site.com", "via site", " Naam: ".$_POST['naam']." E-mail: ".$_POST['email']." Bericht: ".$_POST['bericht']." ", "From: ".$_POST['naam']." <".$_POST['email'].">"); $subject = "je bericht aan Ceci Casariego"; $msg = " Dit is een automatisch verzonden mail. Gelieve niet te antwoorden. Beste $_POST[naam], Bedankt voor je bericht aan Ceci. Ze zal je zo snel mogelijk beantwoorden Dit was je bericht: $_POST[bericht] "; mail($_POST[email], $subject, $msg); echo 'Bedankt.<br><br>Je bericht is verzonden, <br>en je zult een bevestiging ontvangen. <br><br> <br><br>'; } else{ echo 'Gelieve alle velden in te vullen<br><br>Je naam, email adres en bericht<br> zijn verplichte velden.<br><br><a href="contactNL.html"><font color="#565656;">[graag opnieuw]</font></a><br><br> <br>'; } } ?>
But when I send the mail, the attached file isn't sent. What needs to be changed in the php ?Code:<script type="text/JavaScript"> function clearDefault(el) { if (el.defaultValue==el.value) el.value = "" } </script> <form name="form1" method="post" action="contactNL.php"> <input type="hidden" name="action" value="send"> <input type="text" name="naam" value=" je naam" onfocus="clearDefault(this)" style="border-top:0px; border-left: 1px dotted #cc6600; border-right:0px; border-bottom: 1px dotted #cc6600; width:150px"> <br> <input type="text" name="email" value=" je email adres" onfocus="clearDefault(this)" style="border-top:0px; border-left: 1px dotted purple; border-right:0px; border-bottom: 1px dotted purple; width:150px;"> <br> <input type="file" name="fieldname" style="border-top:0px; border-left: 1px dotted purple; border-right:0px; border-bottom: 1px dotted purple; width:150px;"><br> <textarea name="bericht" style="border-top:0px; border-left:1px dotted #0066cc; border-right:0px; border-bottom: 1px dotted #0066cc; width:150px; height:70px" onfocus="clearDefault(this)"> je bericht</textarea> <br> <input type="image" src="images/sendarrow.gif" value="send"> <img src="images/clear.gif" onclick="document.getElementById('form1').reset();" style="cursor:pointer"> </form>
The attachment is not oligatory; the other fields need to be filled in.



Reply With Quote



Bookmarks