Form error

Gestart doorStef2 reacties44 weergaven

3 berichten · pagina 1 van 1

Stef

Lid · Topicstarter

Berichten
10.150
Reputatie
2
Punten
0,00
Lid sinds
Laatst gezien
Ik gebruik het form script van Tyler, maar ik snap niet helemaal wat er ingevuld moet worden...
ik heb:

[COLOR= #0000BB]<?[/COLOR]php
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]verstuur[/COLOR][COLOR= #007700]])){[/COLOR]

[COLOR= #FF8000]/* Het e-mail waar het naartoe moet */[/COLOR]
[COLOR= #0000BB]$myemail[/COLOR]  [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"magjijnietweten@hotmail.com"[/COLOR][COLOR= #007700];[/COLOR]

[COLOR= #FF8000]/* Alle formulier inputs ophalen*/[/COLOR]
[COLOR= #0000BB]$yourname[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]yourname[/COLOR][COLOR= #007700]];[/COLOR]
[COLOR= #0000BB]$email[/COLOR]    [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]email[/COLOR][COLOR= #007700]];[/COLOR]
[COLOR= #0000BB]$onderwerp[/COLOR][COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]onderwerp[/COLOR][COLOR= #007700]];[/COLOR]
[COLOR= #0000BB]$how[/COLOR]       [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]how[/COLOR][COLOR= #007700]];[/COLOR]
[COLOR= #0000BB]$comments[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]comments[/COLOR][COLOR= #007700]];[/COLOR]
[COLOR= #0000BB]$TOS[/COLOR]       [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]TOS[/COLOR][COLOR= #007700]];[/COLOR]
[COLOR= #0000BB]$ip[/COLOR]        [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]REMOTE_ADDR[/COLOR][COLOR= #007700]];[/COLOR]

[COLOR= #FF8000]/* Kijk of het e-mail iets VOOR en NA het @ teken heeft staan, en of er iets NA de . staat. */[/COLOR]
[URL="http://www.php.net/if"]if[/URL] [COLOR= #007700](![/COLOR][URL="http://www.php.net/preg_match"]preg_match[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"/([w-]+@[w-]+.[w-]+)/"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$email[/COLOR][COLOR= #007700]))
{[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"Uw e-mailadres voldoet niet aan onze eisen! <a href=contact.php>klik hier</a> om terug te gaan."[/COLOR][COLOR= #007700]);[/COLOR]
    [URL="http://www.php.net/exit"]exit[/URL][COLOR= #007700]();
}[/COLOR]

[COLOR= #FF8000]/* Check of alles is ingevuld */[/COLOR]
[URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$yourname[/COLOR] [COLOR= #007700]==[/COLOR] NULL OR [COLOR= #0000BB]$onderwerp[/COLOR] [COLOR= #007700]==[/COLOR] NULL OR [COLOR= #0000BB]$comments[/COLOR] [COLOR= #007700]==[/COLOR] NULL OR [COLOR= #0000BB]$TOS[/COLOR] [COLOR= #007700]==[/COLOR] NULL[COLOR= #007700]) {[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"Vul a.u.b alle velden in voor u op verzenden drukt! <a href=contact.php>klik hier</a> om terug te gaan."[/COLOR][COLOR= #007700]);[/COLOR]
    [URL="http://www.php.net/exit"]exit[/URL][COLOR= #007700]();
}[/COLOR]

[COLOR= #FF8000]/* Opmaak het bericht dat naar $myemail gaat */[/COLOR]
[COLOR= #0000BB]$message[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"Beste,

Het contact formulier is ingevuld! :

Naam: $yourname
E-mail: $email
Onderwerp: $onderwerp

Hoe heeft hij/zij ons gevonden?: $how

Het bericht:
$comments

Het bericht is verzonden vanaf het IP: $ip

Einde van het bericht.
"[/COLOR][COLOR= #007700];[/COLOR]

[COLOR= #FF8000]/* extra header functie in mail */[/COLOR]
[COLOR= #0000BB]$headers[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"From: $yourname <$email>
"[/COLOR][COLOR= #007700];[/COLOR]

[COLOR= #FF8000]/* stuur de mail */[/COLOR]
[URL="http://www.php.net/mail"]mail[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$myemail[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$onderwerp[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$message[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$headers[/COLOR][COLOR= #007700]);[/COLOR]

[COLOR= #FF8000]/* doorstuur naar bedankt pagina */[/COLOR]
[URL="http://www.php.net/header"]header[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]Location: contact.php[/COLOR][COLOR= #007700]);[/COLOR]

[URL="http://www.php.net/exit"]exit[/URL][COLOR= #007700]();

}[/COLOR][URL="http://www.php.net/else"]else[/URL][COLOR= #007700]{[/COLOR]
?>
    <html>
    <body>
    <form action="#" method="post">
    <b>Uw naam:</b><br />
    <input type="text" name="yourname" /><br /><br />
    <b>Uw e-mailadres:</b><br />
    <input type="text" name="email" size="30px"/>
    <br /> <br />
    <b>Het onderwerp van uw bericht:</b><br />
    <input type="radio" name="onderwerp" value="Vraag" checked="checked" /> Vraag
    <input type="radio" name="onderwerp" value="Bestelling" /> Bestelling
    <input type="radio" name="onderwerp" value="klacht"  /> Klacht
    <input type="radio" name="onderwerp" value="Overige" /> Overige<br /> 
    <br />
    <b>Hoe heeft u ons gevonden?</b><br />
    <select name="how">
    <option>Wil ik liever niet melden</option>
    <option>Google</option>
    <option>Mond tot mond reclame</option>
    <option>Link vanaf een andere website</option>
    <option>Overige</option>
    </select>
    <br /> <br />
    <b>Uw bericht:</b><br />
    <i>*Geef zoveel mogelijk details in geval van een klacht.</i><br />
    <textarea name="comments" rows="20" cols="60" class="textarea"></textarea><br>
    <input type="checkbox" name="TOS" value="TOS">Ik maak geen misbruik van dit contact formulier.<br>
    <input type="submit" value="verstuur" name="verstuur"> &nbsp; <input type="reset" value="Verwijder velden" />
    </form>
    </body>
    </html>
<?php


En dan krijg ik als ik op "verzend" klik:

Warning: Cannot modify header information - headers already sent by (output started at /home/ilyasftw/domains/stefcraft.nl/public_html/contact.php:16) in /home/ilyasftw/domains/stefcraft.nl/public_html/contact.php on line 143


Wat moet ik dan bij de "header" ofzo invullen?
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
Er is al HTML verzonden voor je de header plaatst, en dat mag niet.
Los daarvan is dit script rijp voor de vuilnisbak, want het is een grote spammachine omdat de headers niet worden gecontroleerd. Ook exit; is nergens voor nodig.
0
Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
Waarom exit(); ?

// aarclay was me voor
0

Jouw reactie

Deel je idee, stel een vraag of help een ander verder.

Editor laden…

Praat mee met de One2xs-community.

Inloggen om te reageren