verzend form doet het niet - PHP

Gestart doorFreestyle1 reacties55 weergaven

2 berichten · pagina 1 van 1

Freestyle

Lid · Topicstarter

Berichten
7.681
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Ik heb een form wat gegevens verzend maar hij doet het niet. Hij verwerkt de gegevens niet. Ik denk dat de fout bij de controle zit of alles goed is ingevuld, maar ik kan hem zelf niet vinden.

Code:
Spoiler tonen
[COLOR= #0000BB]<?php[/COLOR]
[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]verzend[/COLOR][COLOR= #007700]])) 
                                {[/COLOR]
                                    [COLOR= #0000BB]$naam[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR]htmlentities[COLOR= #007700]([/COLOR][URL="http://www.php.net/addslashes"]addslashes[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]naam[/COLOR][COLOR= #007700]])));[/COLOR]
                                    [COLOR= #0000BB]$email[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR]htmlentities[COLOR= #007700]([/COLOR][URL="http://www.php.net/addslashes"]addslashes[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]email[/COLOR][COLOR= #007700]])));[/COLOR]
                                    [COLOR= #0000BB]$bericht[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR]htmlentities[COLOR= #007700]([/COLOR][URL="http://www.php.net/addslashes"]addslashes[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]bericht[/COLOR][COLOR= #007700]])));[/COLOR]
                                    [COLOR= #0000BB]$error[/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]$naam[/COLOR][COLOR= #007700])) {[/COLOR]
                                        [COLOR= #0000BB]$error[/COLOR][COLOR= #007700][] =[/COLOR] [COLOR= #DD0000]U heeft geen naam ingevuld![/COLOR][COLOR= #007700];
                                    }[/COLOR] [URL="http://www.php.net/elseif"]elseif[/URL] [COLOR= #007700]([/COLOR][URL="http://www.php.net/empty"]empty[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$email[/COLOR][COLOR= #007700])) {[/COLOR]
                                        [COLOR= #0000BB]$error[/COLOR][COLOR= #007700][] =[/COLOR] [COLOR= #DD0000]U heeft geen email address ingevuld![/COLOR][COLOR= #007700];
                                    }[/COLOR] [URL="http://www.php.net/elseif"]elseif[/URL] [COLOR= #007700]([/COLOR][URL="http://www.php.net/empty"]empty[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$bericht[/COLOR][COLOR= #007700])) {[/COLOR]
                                        [COLOR= #0000BB]$error[/COLOR][COLOR= #007700][] =[/COLOR] [COLOR= #DD0000]U heeft geen bericht ingevoerd![/COLOR][COLOR= #007700];
                                    }[/COLOR]
                                    [URL="http://www.php.net/elseif"]elseif[/URL] [COLOR= #007700]([/COLOR][URL="http://www.php.net/strlen"]strlen[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$naam[/COLOR] [COLOR= #007700]>[/COLOR] [COLOR= #0000BB]2[/COLOR][COLOR= #007700])) {[/COLOR]
                                        [COLOR= #0000BB]$error[/COLOR][COLOR= #007700][] =[/COLOR] [COLOR= #DD0000]U naam moet minimaal 3 karakters bevatten![/COLOR][COLOR= #007700];
                                    }[/COLOR] [URL="http://www.php.net/elseif"]elseif[/URL] [COLOR= #007700]([/COLOR][URL="http://www.php.net/strlen"]strlen[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$bericht[/COLOR] [COLOR= #007700]>[/COLOR] [COLOR= #0000BB]5[/COLOR][COLOR= #007700]) &&[/COLOR] [URL="http://www.php.net/strlen"]strlen[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$bericht[/COLOR] [COLOR= #007700]<[/COLOR] [COLOR= #0000BB]500[/COLOR][COLOR= #007700])) {[/COLOR]
                                        [COLOR= #0000BB]$error[/COLOR][COLOR= #007700][] =[/COLOR] [COLOR= #DD0000]Het bericht moet minimaal 5karakters hebben en maximaal 500![/COLOR][COLOR= #007700];
                                    }[/COLOR] [URL="http://www.php.net/elseif"]elseif[/URL] [COLOR= #007700]([/COLOR][URL="http://www.php.net/count"]count[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$error[/COLOR] [COLOR= #007700]>[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700])) {[/COLOR]
                                            [URL="http://www.php.net/foreach"]foreach[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$error[/COLOR] [COLOR= #007700]as[/COLOR] [COLOR= #0000BB]$fout[/COLOR][COLOR= #007700]) 
                                            {[/COLOR]
                                                [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<p style="color:#ff0000;">[/COLOR][COLOR= #007700];[/COLOR]
                                                [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$fout[/COLOR] [COLOR= #007700].[/COLOR][COLOR= #DD0000]<br />[/COLOR][COLOR= #007700];[/COLOR]
                                                [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Klik <a href="contact.php">hier</a> om het nog een keer te proberen[/COLOR][COLOR= #007700];[/COLOR]
                                                [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]</p>[/COLOR][COLOR= #007700];
                                            }
                                    }[/COLOR]
                                    [URL="http://www.php.net/else"]else[/URL] 
                                    [COLOR= #007700]{[/COLOR]
                                        [COLOR= #0000BB]$iets[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]iets[/COLOR][COLOR= #007700];[/COLOR]
                                        
                                        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<p style="color:#009900">[/COLOR][COLOR= #007700];[/COLOR]
                                        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]succes vol verstuurd! <br />[/COLOR][COLOR= #007700];[/COLOR]
                                        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Klik <a href="index.php">hier</a> om naar de home page te gaan[/COLOR][COLOR= #007700];[/COLOR]
                                        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]</p>[/COLOR][COLOR= #007700];
                                    }
                                }[/COLOR]
?>
Alvast bedankt.
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
1)

if (isset($_POST[verzend])) {


Dit is GEEN goede controle. Je wilt kijken of iets ge-POST is.

if($_SERVER[REQUEST_METHOD]=="POST") {


2)
addslashes() gebruiken voor je query? In combinatie met mysql_real_escape_string(). Das vragen om problemen... Het gebruik van mysql_real_escape_string() alleen al het beste.

3)
Freestyle schreef:
maar ik kan hem zelf niet vinden.
Problemen kan je isoleren, dus kijk eens WAAR het fout loopt, knal eens wat echos in je code, en zie waar het stukloopt.
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