Fout in een contactscript

Gestart doorOelbert8 reacties37 weergaven

9 berichten · pagina 1 van 1

Oelbert

Lid · Topicstarter

Berichten
509
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Er zit een fout in het contactscript dat ik gebruik.
Ookal vul je een bericht in, hij zegt: Geen bericht ingevuld.
Voorbeeld: http://www.eftelrijk.nl/contact.php

[COLOR= #0000BB]<?[/COLOR]   
[URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR] [COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]REQUEST_METHOD[/COLOR][COLOR= #007700]] ==[/COLOR] [COLOR= #DD0000]POST[/COLOR][COLOR= #007700])  
{[/COLOR]  
    [COLOR= #0000BB]$aError[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/array"]array[/URL][COLOR= #007700]();[/COLOR]  
      
    [URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]sNaam[/COLOR][COLOR= #007700]] ==[/COLOR] [COLOR= #DD0000]""[/COLOR] [COLOR= #007700])  
    {[/COLOR]  
         [COLOR= #0000BB]$aError[/COLOR][COLOR= #007700][] =[/COLOR]   [COLOR= #DD0000]"U heeft uw naam niet ingevuld!"[/COLOR][COLOR= #007700];  
    }[/COLOR]  
    [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/empty"]empty[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]sMail[/COLOR][COLOR= #007700]]) || ![/COLOR][URL="http://www.php.net/eregi"]eregi[/URL] [COLOR= #007700]([/COLOR] [COLOR= #DD0000]@[/COLOR][COLOR= #007700],[/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]sMail[/COLOR][COLOR= #007700]] ) || ![/COLOR][URL="http://www.php.net/eregi"]eregi[/URL] [COLOR= #007700]([/COLOR] [COLOR= #DD0000].[/COLOR][COLOR= #007700],[/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]sMail[/COLOR][COLOR= #007700]] ) ||[/COLOR] [URL="http://www.php.net/eregi"]eregi[/URL] [COLOR= #007700]([/COLOR] [COLOR= #DD0000] [/COLOR][COLOR= #007700],[/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]sMail[/COLOR][COLOR= #007700]] ) )   
    {[/COLOR]   
       [COLOR= #0000BB]$aError[/COLOR][COLOR= #007700][]    =[/COLOR]    [COLOR= #DD0000]Uw heeft uw emailadres niet ingevult![/COLOR][COLOR= #007700];   
    }[/COLOR]   
    [URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]comment[/COLOR][COLOR= #007700]] ==[/COLOR] [COLOR= #DD0000]""[/COLOR] [COLOR= #007700])  
    {[/COLOR]  
         [COLOR= #0000BB]$aError[/COLOR][COLOR= #007700][] =[/COLOR]    [COLOR= #DD0000]"U heeft geen bericht ingevuld!"[/COLOR][COLOR= #007700];  
    }[/COLOR]  
    [URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR] [URL="http://www.php.net/count"]count[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$aError[/COLOR][COLOR= #007700]) ==[/COLOR] [COLOR= #0000BB]0[/COLOR] [COLOR= #007700])   
    {[/COLOR]   
        [COLOR= #0000BB]$sBricht[/COLOR] [COLOR= #007700]=[/COLOR] htmlspecialchars [COLOR= #007700]([/COLOR] [URL="http://www.php.net/addslashes"]addslashes[/URL] [COLOR= #007700]([/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]sComment[/COLOR][COLOR= #007700]] ) );[/COLOR]   
           
        [URL="http://www.php.net/mail"]mail[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"EMAILADRESWEGGEHAALD"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]"Contact Formulier Eftelrijk"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$sBericht[/COLOR][COLOR= #007700]);[/COLOR]   
          
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Uw bericht is verzonden. We zullen hier zo spoedig mogelijk op reageren. Bedankt!"[/COLOR][COLOR= #007700];  
    }[/COLOR]   
    [URL="http://www.php.net/else"]else[/URL]  
    [COLOR= #007700]{[/COLOR]  
              [URL="http://www.php.net/for"]for[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$i[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700];[/COLOR] [COLOR= #0000BB]$i[/COLOR] [COLOR= #007700]<[/COLOR] [URL="http://www.php.net/count"]count[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$aError[/COLOR][COLOR= #007700]);[/COLOR] [COLOR= #0000BB]$i[/COLOR][COLOR= #007700]++)   
            {[/COLOR]   
                    ?>   
                                                       
                        <table class="tekst">  
                            <tr>  
                                <td>  
                                  
                                    <?=$aError[$i];?>  
                                                              
                                </td>  
                            </tr>  
                        </table>  
                                          
                    [COLOR= #0000BB]<?php[/COLOR]  
            [COLOR= #007700]}  
    }   
}[/COLOR]  
[URL="http://www.php.net/else"]else[/URL]   
[COLOR= #007700]{[/COLOR]   
?>   
<table width="100%" border="0">  
<form name="form" method="post">  
  <tr>  
      <td width="20%">Naam:</td>  
    <td width="80%"><input type="text" name="sNaam" size="30"></td>  
  </tr>  
  <tr>  
      <td width="20%">E-Mail:</td>  
    <td width="80%"><input type="text" name="sMail" size="30"></td>  
  </tr>  
  <tr>  
      <td width="20%">Uw bericht: </td>  
    <td width="80%"><textarea name="sComment" rows="4" cols="30"></textarea></td>  
  </tr>  
  <tr>  
      <td width="100%" colspan="2"><input type="reset" value="Wis"> <input type="submit" name="submit" value="Verzend"></td>  
  </tr>  
</form>     
</table>  
[COLOR= #0000BB]<?[/COLOR]   
[COLOR= #007700]}[/COLOR]   
?>
0
Rik

Lid

Berichten
18.393
Reputatie
0
Punten
0,04
Lid sinds
Laatst gezien
[COLOR= #0000BB]<?[/COLOR]   
[URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR] [COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]REQUEST_METHOD[/COLOR][COLOR= #007700]] ==[/COLOR] [COLOR= #DD0000]POST[/COLOR][COLOR= #007700])  
{[/COLOR]  
    [COLOR= #0000BB]$aError[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/array"]array[/URL][COLOR= #007700]();[/COLOR]  
      
    [URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]sNaam[/COLOR][COLOR= #007700]] ==[/COLOR] [COLOR= #DD0000]""[/COLOR] [COLOR= #007700])  
    {[/COLOR]  
         [COLOR= #0000BB]$aError[/COLOR][COLOR= #007700][] =[/COLOR]   [COLOR= #DD0000]"U heeft uw naam niet ingevuld!"[/COLOR][COLOR= #007700];  
    }[/COLOR]  
    [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/empty"]empty[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]sMail[/COLOR][COLOR= #007700]]) || ![/COLOR][URL="http://www.php.net/eregi"]eregi[/URL] [COLOR= #007700]([/COLOR] [COLOR= #DD0000]@[/COLOR][COLOR= #007700],[/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]sMail[/COLOR][COLOR= #007700]] ) || ![/COLOR][URL="http://www.php.net/eregi"]eregi[/URL] [COLOR= #007700]([/COLOR] [COLOR= #DD0000].[/COLOR][COLOR= #007700],[/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]sMail[/COLOR][COLOR= #007700]] ) ||[/COLOR] [URL="http://www.php.net/eregi"]eregi[/URL] [COLOR= #007700]([/COLOR] [COLOR= #DD0000] [/COLOR][COLOR= #007700],[/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]sMail[/COLOR][COLOR= #007700]] ) )   
    {[/COLOR]   
       [COLOR= #0000BB]$aError[/COLOR][COLOR= #007700][]    =[/COLOR]    [COLOR= #DD0000]Uw heeft uw emailadres niet ingevult![/COLOR][COLOR= #007700];   
    }[/COLOR]   
    [URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]sComments[/COLOR][COLOR= #007700]] ==[/COLOR] [COLOR= #DD0000]""[/COLOR] [COLOR= #007700])  
    {[/COLOR]  
         [COLOR= #0000BB]$aError[/COLOR][COLOR= #007700][] =[/COLOR]    [COLOR= #DD0000]"U heeft geen bericht ingevuld!"[/COLOR][COLOR= #007700];  
    }[/COLOR]  
    [URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR] [URL="http://www.php.net/count"]count[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$aError[/COLOR][COLOR= #007700]) ==[/COLOR] [COLOR= #0000BB]0[/COLOR] [COLOR= #007700])   
    {[/COLOR]   
        [COLOR= #0000BB]$sBricht[/COLOR] [COLOR= #007700]=[/COLOR] htmlspecialchars [COLOR= #007700]([/COLOR] [URL="http://www.php.net/addslashes"]addslashes[/URL] [COLOR= #007700]([/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]sComment[/COLOR][COLOR= #007700]] ) );[/COLOR]   
           
        [URL="http://www.php.net/mail"]mail[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"EMAILADRESWEGGEHAALD"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]"Contact Formulier Eftelrijk"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$sBericht[/COLOR][COLOR= #007700]);[/COLOR]   
          
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Uw bericht is verzonden. We zullen hier zo spoedig mogelijk op reageren. Bedankt!"[/COLOR][COLOR= #007700];  
    }[/COLOR]   
    [URL="http://www.php.net/else"]else[/URL]  
    [COLOR= #007700]{[/COLOR]  
              [URL="http://www.php.net/for"]for[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$i[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700];[/COLOR] [COLOR= #0000BB]$i[/COLOR] [COLOR= #007700]<[/COLOR] [URL="http://www.php.net/count"]count[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$aError[/COLOR][COLOR= #007700]);[/COLOR] [COLOR= #0000BB]$i[/COLOR][COLOR= #007700]++)   
            {[/COLOR]   
                    ?>   
                                                       
                        <table class="tekst">  
                            <tr>  
                                <td>  
                                  
                                    <?=$aError[$i];?>  
                                                              
                                </td>  
                            </tr>  
                        </table>  
                                          
                    [COLOR= #0000BB]<?php[/COLOR]  
            [COLOR= #007700]}  
    }   
}[/COLOR]  
[URL="http://www.php.net/else"]else[/URL]   
[COLOR= #007700]{[/COLOR]   
?>   
<table width="100%" border="0">  
<form name="form" method="post">  
  <tr>  
      <td width="20%">Naam:</td>  
    <td width="80%"><input type="text" name="sNaam" size="30"></td>  
  </tr>  
  <tr>  
      <td width="20%">E-Mail:</td>  
    <td width="80%"><input type="text" name="sMail" size="30"></td>  
  </tr>  
  <tr>  
      <td width="20%">Uw bericht: </td>  
    <td width="80%"><textarea name="sComments" rows="4" cols="30"></textarea></td>  
  </tr>  
  <tr>  
      <td width="100%" colspan="2"><input type="reset" value="Wis"> <input type="submit" name="submit" value="Verzend"></td>  
  </tr>  
</form>     
</table>  
[COLOR= #0000BB]<?[/COLOR]   
[COLOR= #007700]}[/COLOR]   
?>
0
Oelbert

Lid · Topicstarter

Berichten
509
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Top bedankt!
0
Rik

Lid

Berichten
18.393
Reputatie
0
Punten
0,04
Lid sinds
Laatst gezien
Alleen weet ik nu al, dat hij niets gaat verzenden schater
[COLOR= #0000BB]<?[/COLOR]   
    [URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR] [COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]REQUEST_METHOD[/COLOR][COLOR= #007700]] ==[/COLOR] [COLOR= #DD0000]POST[/COLOR][COLOR= #007700])  
    {[/COLOR]  
        [COLOR= #0000BB]$aError[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/array"]array[/URL][COLOR= #007700]();[/COLOR]  
          
        [URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][URL="http://www.php.net/empty"]empty[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]sNaam[/COLOR][COLOR= #007700]]))  
        {[/COLOR]  
             [COLOR= #0000BB]$aError[/COLOR][COLOR= #007700][] =[/COLOR]   [COLOR= #DD0000]"U heeft uw naam niet ingevuld!"[/COLOR][COLOR= #007700];  
        }[/COLOR]  
        [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/empty"]empty[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]sMail[/COLOR][COLOR= #007700]]) || ![/COLOR]filter_var[COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]sMail[/COLOR][COLOR= #007700]],[/COLOR] FILTER_VALIDATE_EMAIL[COLOR= #007700]))   
        {[/COLOR]   
           [COLOR= #0000BB]$aError[/COLOR][COLOR= #007700][]    =[/COLOR]    [COLOR= #DD0000]Uw heeft uw emailadres niet ingevult![/COLOR][COLOR= #007700];   
        }[/COLOR]   
        [URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][URL="http://www.php.net/empty"]empty[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]sComments[/COLOR][COLOR= #007700]]))  
        {[/COLOR]  
             [COLOR= #0000BB]$aError[/COLOR][COLOR= #007700][] =[/COLOR]    [COLOR= #DD0000]"U heeft geen bericht ingevuld!"[/COLOR][COLOR= #007700];  
        }[/COLOR]  
        [URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR] [URL="http://www.php.net/count"]count[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$aError[/COLOR][COLOR= #007700]) ==[/COLOR] [COLOR= #0000BB]0[/COLOR] [COLOR= #007700])   
        {[/COLOR]   
            [COLOR= #0000BB]$sBericht[/COLOR] [COLOR= #007700]=[/COLOR] htmlspecialchars[COLOR= #007700]([/COLOR][URL="http://www.php.net/addslashes"]addslashes[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]sComment[/COLOR][COLOR= #007700]]));[/COLOR]   
               
            [URL="http://www.php.net/mail"]mail[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"EMAILADRESWEGGEHAALD"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]"Contact Formulier Eftelrijk"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$sBericht[/COLOR][COLOR= #007700]);[/COLOR]   
              
            [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Uw bericht is verzonden. We zullen hier zo spoedig mogelijk op reageren. Bedankt!"[/COLOR][COLOR= #007700];  
        }[/COLOR]   
        [URL="http://www.php.net/else"]else[/URL]  
        [COLOR= #007700]{[/COLOR]  
            [URL="http://www.php.net/for"]for[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$i[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700];[/COLOR] [COLOR= #0000BB]$i[/COLOR] [COLOR= #007700]<[/COLOR] [URL="http://www.php.net/count"]count[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$aError[/COLOR][COLOR= #007700]);[/COLOR] [COLOR= #0000BB]$i[/COLOR][COLOR= #007700]++)   
            {[/COLOR]   
                ?>   
                    <table class="tekst">  
                        <tr>  
                            <td>  
                                [COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$aError[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]$i[/COLOR][COLOR= #007700]];[/COLOR] ?>  
                            </td>  
                        </tr>  
                    </table>                           
                [COLOR= #0000BB]<?php[/COLOR]  
            [COLOR= #007700]}  
        }   
    }[/COLOR]  
    [URL="http://www.php.net/else"]else[/URL]   
    [COLOR= #007700]{[/COLOR]   
        ?>   
            <table width="100%" border="0">  
                <form name="form" method="post">  
                    <tr>  
                        <td width="20%">Naam:</td>  
                        <td width="80%"><input type="text" name="sNaam" size="30"></td>  
                    </tr>  
                    <tr>  
                        <td width="20%">E-Mail:</td>  
                        <td width="80%"><input type="text" name="sMail" size="30"></td>  
                    </tr>  
                    <tr>  
                        <td width="20%">Uw bericht: </td>  
                        <td width="80%"><textarea name="sComments" rows="4" cols="30"></textarea></td>  
                    </tr>  
                    <tr>  
                        <td width="100%" colspan="2"><input type="reset" value="Wis"> <input type="submit" name="submit" value="Verzend"></td>  
                    </tr>  
                </form>     
            </table>  
        [COLOR= #0000BB]<?[/COLOR]   
    [COLOR= #007700]}[/COLOR]   
?>


Die wel
0
Oelbert

Lid · Topicstarter

Berichten
509
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Idd, bedankt
0
Oelbert

Lid · Topicstarter

Berichten
509
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Ik krijg een mailtje, maar die is helemaal leeg
0
Berichten
13.482
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
regel 20,
een s vergeten:

$sBericht = htmlspecialchars(addslashes($_POST[sComment]));
moet zijn
$sBericht = htmlspecialchars(addslashes($_POST[sComments]));
0
Oelbert

Lid · Topicstarter

Berichten
509
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Nu komt het bericht wel binnen, maar de naam en het emailadres nog niet
0
Rik

Lid

Berichten
18.393
Reputatie
0
Punten
0,04
Lid sinds
Laatst gezien
Oelbert schreef:
Nu komt het bericht wel binnen, maar de naam en het emailadres nog niet
Dat zet je ook nergens in het script dat dat in het bericht moet komen? =]
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