Form versturen naar email
april 2007
-
christiaanHallo mensen,
Ik heb ff snel een site-je in elkaar geknutseld voor een LAN die ik ga organiseren. Het probleem is dat ik een inschrijfformuliertje heb, die moet worden verstuurd naar mn e-mail. Nu zijn er 1000en topics op internet over contact scriptjes, maar ik vind ze allemaal erg onduidelijk. Kan iemand toevallig een klein scriptje geven :$ als het niet teveel werk is uiteraard. Een tutorial op internet volledig (heb er al genoeg gehad) zou ook wel mogen. Bij voorbaat dank jongens.
Oh ja, hier de url [url]http://christiaan101.ch.funpic.org/inschrijven.html[/url]03 april 2007 21:45 -
gerjanwaarschijnlijk kan ik wel helpen
kzal proberen even wat tijd vrij te maken.:)
je wilt denk ik gewoon zo:
[quote]VoorNaam: [voornaam]
Achternaam: [achternaam]
enz.
[/quote]
en het bestandje moet dus mailformulier.php heten
03 april 2007 22:11 -
louwrensvet LAN party(H)
In Dreamweaver of Expression Web zit zo'n formulier wizard, heb het zelfs nog niet gedaan
03 april 2007 22:12 -
christiaanIk werk met dreamweaver en heb zon ding nog niet gevonden.
Maar dit is het scriptje van de form:
[code]
<form method="post" action="mailformulier.php">
<table text="#333366">
<tr>
<td class="style1"><font color="333366"> Voornaam:</td>
<td><input type="text" name="voornaam"></td>
</tr>
<tr>
<td class="style1"><font color="#333366"> Achternaam:</td>
<td><input type="text" name="achternaam"></td>
</tr>
<tr>
<td><font color="#333366"> <span class="style1">Leeftijd:</span></td>
<td><input type="text" name="leeftijd"></td>
</tr>
<tr>
<td><font color="#333366"><span class="style1"> Adres:</span></td>
<td><input type="text" name="adres"></td>
</tr>
<tr>
<td><font color="#333366"> <span class="style1">Postcode:</span></td>
<td><input type="text" name="postcode"></td>
</tr>
<tr>
<td><font color="#333366"> <span class="style1">Woonplaats:</span></td>
<td><input type="text" name="woonplaats"></td>
</tr>
<tr>
<td valign="middle"><font color="#333366"> <span class="style1">Telefoonnummer Huis</span></td>
<td><input type="text" name="Telefoonnummer huis"></td>
</tr>
<tr>
<td valign="middle"><font color="#333366"> <span class="style1">Telefoonnummer 06</span></td>
<td><input type="text" name="Telefoonnummer 06 "></td>
</tr>
<tr>
<td class="style1"><font color="#333366"> E-mailadres:</td>
<td><input type="text" name="emailadres"></td>
</tr>
<tr>
<td class="style1"> Opmerkingen</td>
<td><label for="Sponsoring" class="style1"></label>
<textarea name="Overige Informatie" rows="2" COLS="50"></TEXTAREA></td>
</tr>[/code]
die "action"=mailformulier.php moet dus ff werken
04 april 2007 08:13 -
leviathanIk zie dat je funpic als host hebt, en volgens mij hebben deze php (+MySQL?) support. Ookal is een php script een stuk ingewikkelder, toch zou ik aanraden gegevens in een database op te laten slaan in plaats van naar jouw email te mailen, gewoonweg omdat het mailsysteem niet altijd werkt (algemeen bekend, en bevestigd door eigen ervaring uit mijn vroege html-tijd) omdat hotmail-adressen hiermee vaak in de knoop komen. Met outlook werkt het goed samen, maar weer niet iedereen gebruikt dat. Ten tweede ben je met een (html) script (= het simpelste) erg kwetsbaar voor spam aangezien webcrawlers heel simpel je email adres in de broncode af kunnen lezen. Nog een voordeel voor de database is, is dat alles meteen verwerkt word en je veel met de informatie kunt doen (optellen, totaal, overzichtelijk).
Een php tut waar ik zelf veel aan gehad heb kun je hier vinden, volgens mij kun je gewoon een tut voor een nieuwssysteem gebruiken, het werkt toch hetzelfde als het op gegevens opslaan in een DB aankomt.
Als je toch voor de mail wilt kiezen aan deze html-tut (mn eerste ervaring) heb ik toentertijd veel gehad. Ik vind dat het mailsysteem er simpel in uitgelegd word.
PHP mail scriptjes kun je natuurlijk ook maken, dat zal ongeveer een middenweg opleveren, en dat is ook eventjes zoeken naar een gepaste tut.
Oh ja:
[quote][code]<form method="post" action="mailformulier.php">
<table text="#333366">
<tr>
<td class="style1"><font color="333366"> Voornaam:</td>
<td><input type="text" name="voornaam"></td>
</tr>
<tr>
<td class="style1"><font color="#333366"> Achternaam:</td>
<td><input type="text" name="achternaam"></td>
</tr>
<tr>
<td><font color="#333366"> <span class="style1">Leeftijd:</span></td>
<td><input type="text" name="leeftijd"></td>
</tr>
<tr>
<td><font color="#333366"><span class="style1"> Adres:</span></td>
<td><input type="text" name="adres"></td>
</tr>
<tr>
<td><font color="#333366"> <span class="style1">Postcode:</span></td>
<td><input type="text" name="postcode"></td>
</tr>
<tr>
<td><font color="#333366"> <span class="style1">Woonplaats:</span></td>
<td><input type="text" name="woonplaats"></td>
</tr>
<tr>
<td valign="middle"><font color="#333366"> <span class="style1">Telefoonnummer Huis</span></td>
<td><input type="text" name="Telefoonnummer huis"></td>
</tr>
<tr>
<td valign="middle"><font color="#333366"> <span class="style1">Telefoonnummer 06</span></td>
<td><input type="text" name="Telefoonnummer 06 "></td>
</tr>
<tr>
<td class="style1"><font color="#333366"> E-mailadres:</td>
<td><input type="text" name="emailadres"></td>
</tr>
<tr>
<td class="style1"> Opmerkingen</td>
<td><label for="Sponsoring" class="style1"></label>
<textarea name="Overige Informatie" rows="2" COLS="50"></TEXTAREA></td>
</tr>
[/code][/quote]Submit knop ontbreekt.04 april 2007 15:18 -
christiaanJa die zit er wel op, maar vergeten te kopieren.
Ik blijf toch liever bij het mailsysteem, en funpic is btw niet mn definitieve host, maar gewoon ff om de boel te testen. De tuts die jij linkt, zijn eigenlijk allemaal niet van toepassing, want dat html gedeelte snap ik allemaal wel.04 april 2007 16:14 -
gerjanmaar je wilt dus wel een php script die het naar jou mailt?
en dus niet:[code]
<form action="mailto:tacoman@davesite.com" method="POST" enctype="text/plain">
</form>[/code]
Ik wil dit wel maken morgen en overmorgen vrij:)
04 april 2007 17:34 -
christiaan[code]<form action="mailto:tacoman@davesite.com" method="POST" enctype="text/plain">
</form>[/code]
Dit wist ik al, maar dit is een beetje amateuristisch want hij opent dan outlook enzo.. het moet gewoon wel met php gebeuren ja..
04 april 2007 17:43 -
xp 204 april 2007 18:58
-
gerjankben alvast begonnen. kweet niet of dit een goed begin is maar ik vind het zo handig als het zo goed is.
kga morgen verder
[code]<html>
<head>
<title></title>
</head>
<body>
<?php
$voornaam = $_POST['voornaam']; // maakt van de geposte voornaam een variabele. Hieronder hetzelfde met andere invoeringen. Niet perse nodig maar wel overzichterlijker.(vind ik)
$achternaam = $_POST['achternaam'];
$leeftijd = $_POST['leeftijd'];
$adres = $_POST['adres'];
$postcode = $_POST['postcode'];
$woonplaats = $_POST['woonplaats'];
$telthuis = $_POST['telefoonnummer huis'];
$telmobiel = $_POST['telefoonnummer 06'];
$emailadres = $_POST['emailadres'];
$overigeinfo = $_POST['Overige Informatie'];
?>
</body>
</html>[/code]
__________
edit:
Kben nu al aardig ver alleen ik krijg het maar niet voor elkaar om in de mail een enter te doen achter elke gevraagde gegevens.
voornaam gerjan achternaam de koning enz. komt er nu te staan. maar het moet:
voornaam gerjan
achternaam de koning
ik weet dat dit of met <br> of met \n of \r moet. Alleen weet ik niet tussen welke haakjes het nu wel en niet moet enz.
Kan iemand me hoer mee helpen?
=========================================================================
EDIT
Hij werkt nu al wel helemaal goed bij mij alleen krijg je dus een mail waarin alle gegevens achterelkaar staan.
[code]<form method="post" action="mailformulier.php">
<table>
<tr>
<td ><font color="333366"> Voornaam:</td>
<td><input type="text" name="voornaam"></td>
</tr>
<tr>
<td><font color="#333366"> Achternaam:</td>
<td><input type="text" name="achternaam"></td>
</tr>
<tr>
<td><font color="#333366"> Leeftijd:</td>
<td><input type="text" name="leeftijd"></td>
</tr>
<tr>
<td><font color="#333366">Adres:</td>
<td><input type="text" name="adres"></td>
</tr>
<tr>
<td><font color="#333366"> Postcode:</td>
<td><input type="text" name="postcode"></td>
</tr>
<tr>
<td><font color="#333366"> Woonplaats:</td>
<td><input type="text" name="woonplaats"></td>
</tr>
<tr>
<td valign="middle"><font color="#333366"> Telefoonnummer <td>
<td><input type="text" name="Telefoonnummerhuis"></td>
</tr>
<tr>
<td valign="middle"><font color="#333366"> Telefoonnummer 06</td>
<td><input type="text" name="Telefoonnummer06"></td>
</tr>
<tr>
<td><font color="#333366"> E-mailadres:</td>
<td><input type="text" name="emailadres"></td>
</tr>
<tr>
<td> Opmerkingen</td>
<td><label for="Sponsoring" class="style1"></label>
<textarea name="OverigeInformatie" rows="2" COLS="50"></TEXTAREA></td>
</tr>
<tr>
<td></td>
<td><input type="submit" value="Versturen"><input type="reset" value="Opnieuw"></td>
</table>
</form>[/code]
Hierin is ook wat aangepast. je moet je styles er maar weer in plakken.
PHPscriptje
Dit is niet echt een super goed script ofzo. kweet zeker dat dit beter kan
maar hij werkt wel aardig en als straks die enters er wel in zitten werkt het erg goed.
[code]<html>
<head>
<title>WannaLAN.nl[][] Een LAN-event in het noorden van Nederland</title>
</head>
<body>
<?php
$voornaam = $_POST['voornaam']; // maakt van de geposte voornaam een variabele. Hieronder hetzelfde met andere invoeringen. Niet perse nodig maar wel overzichterlijker.(vind ik)
$achternaam = $_POST['achternaam'];
$leeftijd = $_POST['leeftijd'];
$adres = $_POST['adres'];
$postcode = $_POST['postcode'];
$woonplaats = $_POST['woonplaats'];
$telthuis = $_POST['Telefoonnummerhuis'];
$telmobiel = $_POST['Telefoonnummer06'];
$emailadres = $_POST['emailadres'];
$overigeinfo = $_POST['OverigeInformatie'];
$ontvangstadres = 'christiaan.101@gmail.com';
if (!$voornaam) {
echo 'Je hebt geen voornaam ingevuld';
exit; }
if (!$achternaam) {
echo 'Je hebt geen achternaam ingevuld';
exit; }
if (!$emailadres) {
echo 'Je hebt geen emailadres ingevuld';
exit; }
else {
$bericht = 'Voornaam: ' . $voornaam . ' Achternaam: ' . $achternaam . ' Leeftijd: ' . $leeftijd . ' Adres: ' . $adres . ' Postcode: ' . $postcode . ' Woonplaats: ' . $woonplaats . ' Telefoon thuis: ' . $telthuis . ' 06nummer: ' . $telmobiel . ' Emailadres: ' . $emailadres . ' Overige informatie: ' . $overigeinfo . ' Dit was het mailtje';
mail("$ontvangstadres", "Opgave LAN", $bericht, "From:" . $emailadres . "");
echo "Je hebt je zojuist opgegeven voor de LAN. We verwachten binnenkort je betaling.";
}
?>
</body>
</html> [/code]05 april 2007 22:54 -
christiaanwow, zeer nice gerjan. Ik spreek je vandaag nog wel erover.06 april 2007 09:41
-
gerjantkoste wat tijd maar het werkt ook een beetje.
Kvind het ook leuk om te doen
tgeeft op een 1 of andere manier een kick als het werkt. (net als bij wiskunde sommen):d
06 april 2007 09:59