Kleine Vragen Topic #1

Gestart doorLennard4.284 reacties15.585 weergaven

4.285 berichten · pagina 13 van 286

Berichten
11.263
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Tuurlijk, voor de mensen die nu PHP leren, welke TUT gebruiken jullie? Ikzelf phptuts.nl/view/39
0
Berichten
6.037
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
TIP: Leren van uit bestaande scripts lijkt mij het beste! Nu kan ik al 2 maanden redelijk PHP
0
Berichten
11.263
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Uit welke scriptd leer jij dan?
Ik doe het ogeveer uit beide.
0
Berichten
5.737
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Hoe kom je aan je IP adres als CIDR notatie of iets dergelijks? Al op google opgezocht maar kan het niet vinden
0
Berichten
6.037
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Sanderc schreef:
Uit welke scriptd leer jij dan?
Ik doe het ogeveer uit beide.
Er bestaan miljoenen scripts.. kies er eentje uit zou ik zeggen
0
Berichten
14.363
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Als je browser PHP kan lezen en weergeven, dan moet het toch ook mogelijk zijn om iemand anders zijn code te bekijken?
//ohnee, ik snap het al. Je browser leest alleen de output.
0
Rik

Lid

Berichten
18.393
Reputatie
0
Punten
0,04
Lid sinds
Laatst gezien
Rogier schreef:
= definieren
== vergelijken
=== vergelijken BOOLEAN
! niet gelijk aan
>= groter || gelijk aan
<= kleiner || gelijk aan
> groter
< kleiner
Die klopt niet helemaal.

=== betekend exact gelijk aan.

[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR]TRUE [COLOR= #007700]===[/COLOR] TRUE[COLOR= #007700]) {  
}[/COLOR] [COLOR= #FF8000]// Dit zal uitgevoerd worden[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR]TRUE [COLOR= #007700]===[/COLOR] [COLOR= #DD0000]"TRUE"[/COLOR][COLOR= #007700]) { 
}[/COLOR] [COLOR= #FF8000]// Dit zal niet uitgevoerd worden[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR]TRUE [COLOR= #007700]==[/COLOR] TRUE[COLOR= #007700]) {  
}[/COLOR] [COLOR= #FF8000]// Dit wel[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR]TRUE [COLOR= #007700]==[/COLOR] [COLOR= #DD0000]"TRUE"[/COLOR][COLOR= #007700]) {  
}[/COLOR] [COLOR= #FF8000]// Dit wel[/COLOR]
?>


bij === moet het type dat je vergelijk ook overeen komen.
0
Berichten
7.806
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Hoe laat ik hem lege fields checken. Heb dit:

[COLOR= #0000BB]<?php[/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]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]signup[/COLOR][COLOR= #007700]])) {[/COLOR]
[COLOR= #0000BB]$signup_sql[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"INSERT INTO leden VALUES(,"[/COLOR][COLOR= #007700].[/COLOR]sqlsafe[COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]username[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000]","[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/md5"]md5[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]password[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000]","[/COLOR][COLOR= #007700].[/COLOR]sqlsafe[COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]rang[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000]")"[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$signup_sql[/COLOR] [COLOR= #007700]==[/COLOR] TRUE[COLOR= #007700]) {[/COLOR]
                          [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Lid succesvol toegevoegd!"[/COLOR][COLOR= #007700];
                          }[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
                          [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Error: Dit lid is niet succesvol aangemeld wegens: "[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]();
                          }
        }[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"<form method="POST" action="">
<table border="0" cellpadding="0" cellspacing="0" width="32%" id="table1">
        <tr>
                <td width="139">Naam</td>
                <td>
                        <p><input type="text" name="username" size="26"></p>
                </td>
        </tr>
        <tr>
                <td width="139">Wachtwoord:</td>
                <td><input type="text" name="password" size="26"></td>
        </tr>
        <tr>
                <td width="139">Rang:</td>
                <td><select  name="rang">
                <option>DJ</option>
                <option>Hoofd-DJ</option>
                <option>Support</option>
                <option>Manager</option>
                <option>Admin</option>
            </select></td>
        </tr>

        <tr>
                <td width="139">&nbsp;</td>
                <td><input type="submit" value="Verzenden" name="signup"></td>
        </tr>
</table>
</form>"[/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]username[/COLOR][COLOR= #007700]]) &&[/COLOR] [URL="http://www.php.net/empty"]empty[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]password[/COLOR][COLOR= #007700]])) {[/COLOR]
[URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]<div style="font-family:calibri;width:600px; text-align:center; margin-left:auto; margin-right:auto;margin-top:50px; padding:8px; border:1px solid #9c0006; background:#ffc7ce; color:#9c0006;"><strong>Foutmelding</strong> <br><br>Vul een gebruikersnaam en wachtwoord in!</div>[/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]username[/COLOR][COLOR= #007700]])) {[/COLOR]
[URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]<div style="font-family:calibri;width:600px; text-align:center; margin-left:auto; margin-right:auto;margin-top:50px; padding:8px; border:1px solid #9c0006; background:#ffc7ce; color:#9c0006;"><strong>Foutmelding</strong> <br><br>Vul een gebruikersnaam in!</div>[/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]password[/COLOR][COLOR= #007700]])) {[/COLOR]
[URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]<div style="font-family:calibri;width:600px; text-align:center; margin-left:auto; margin-right:auto;margin-top:50px; padding:8px; border:1px solid #9c0006; background:#ffc7ce; color:#9c0006;"><strong>Foutmelding</strong> <br><br>Vul een wachtwoord in!</div>[/COLOR][COLOR= #007700]);
}[/COLOR]
?>
0
Berichten
11.263
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Bjarnootjuh schreef:
Hoe laat ik hem lege fields checken. Heb dit:
[COLOR= #0000BB]<?php[/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]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]signup[/COLOR][COLOR= #007700]])) {[/COLOR]
[COLOR= #0000BB]$signup_sql[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"INSERT INTO leden VALUES(,"[/COLOR][COLOR= #007700].[/COLOR]sqlsafe[COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]username[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000]","[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/md5"]md5[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]password[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000]","[/COLOR][COLOR= #007700].[/COLOR]sqlsafe[COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]rang[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000]")"[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$signup_sql[/COLOR] [COLOR= #007700]==[/COLOR] TRUE[COLOR= #007700]) {[/COLOR]
                          [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Lid succesvol toegevoegd!"[/COLOR][COLOR= #007700];
                          }[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
                          [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Error: Dit lid is niet succesvol aangemeld wegens: "[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]();
                          }
        }[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"<form method="POST" action="">
<table border="0" cellpadding="0" cellspacing="0" width="32%" id="table1">
        <tr>
                <td width="139">Naam</td>
                <td>
                        <p><input type="text" name="username" size="26"></p>
                </td>
        </tr>
        <tr>
                <td width="139">Wachtwoord:</td>
                <td><input type="text" name="password" size="26"></td>
        </tr>
        <tr>
                <td width="139">Rang:</td>
                <td><select  name="rang">
                <option>DJ</option>
                <option>Hoofd-DJ</option>
                <option>Support</option>
                <option>Manager</option>
                <option>Admin</option>
            </select></td>
        </tr>

        <tr>
                <td width="139">&nbsp;</td>
                <td><input type="submit" value="Verzenden" name="signup"></td>
        </tr>
</table>
</form>"[/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]username[/COLOR][COLOR= #007700]]) &&[/COLOR] [URL="http://www.php.net/empty"]empty[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]password[/COLOR][COLOR= #007700]])) {[/COLOR]
[URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]<div style="font-family:calibri;width:600px; text-align:center; margin-left:auto; margin-right:auto;margin-top:50px; padding:8px; border:1px solid #9c0006; background:#ffc7ce; color:#9c0006;"><strong>Foutmelding</strong> <br><br>Vul een gebruikersnaam en wachtwoord in!</div>[/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]username[/COLOR][COLOR= #007700]])) {[/COLOR]
[URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]<div style="font-family:calibri;width:600px; text-align:center; margin-left:auto; margin-right:auto;margin-top:50px; padding:8px; border:1px solid #9c0006; background:#ffc7ce; color:#9c0006;"><strong>Foutmelding</strong> <br><br>Vul een gebruikersnaam in!</div>[/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]password[/COLOR][COLOR= #007700]])) {[/COLOR]
[URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]<div style="font-family:calibri;width:600px; text-align:center; margin-left:auto; margin-right:auto;margin-top:50px; padding:8px; border:1px solid #9c0006; background:#ffc7ce; color:#9c0006;"><strong>Foutmelding</strong> <br><br>Vul een wachtwoord in!</div>[/COLOR][COLOR= #007700]);
}[/COLOR]
?>


empty()?
Of wat bedoel je?
0
Berichten
7.806
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Dat hij kijkt of ik een formulier veld heb ingevuld. Als ik het nu leeg laat zegt hij gewoon: Lid toegevoegd en kan iedereen zonder ww een gebruikersnaam direct op inloggen drukken.
0
Berichten
11.263
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
[COLOR= #0000BB]<?php[/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]naam[/COLOR][COLOR= #007700]])){[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Naam is niet ingevuld![/COLOR][COLOR= #007700];
}[/COLOR][URL="http://www.php.net/else"]else[/URL][COLOR= #007700]{[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL][COLOR= #DD0000] Naam is wel ingevuld[/COLOR][COLOR= #007700];
}[/COLOR]
?>
0
Berichten
7.806
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Sanderc schreef:
[COLOR= #0000BB]<?php[/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]naam[/COLOR][COLOR= #007700]])){[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Naam is niet ingevuld![/COLOR][COLOR= #007700];
}[/COLOR][URL="http://www.php.net/else"]else[/URL][COLOR= #007700]{[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL][COLOR= #DD0000] Naam is wel ingevuld[/COLOR][COLOR= #007700];
}[/COLOR]
?>
Dat heb ik al, kijk even goed. Ik krijg dan al direct dat hij zegt dat ik het niet heb ingevuld. Maar toch als ik op versturen druk zonder iets in te vullen zegt hij dat het lid is toegevoegd.
0
Berichten
11.263
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Bjarnootjuh schreef:
Eerdere citaten tonen
Sanderc schreef:
[COLOR= #0000BB]<?php[/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]naam[/COLOR][COLOR= #007700]])){[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Naam is niet ingevuld![/COLOR][COLOR= #007700];
}[/COLOR][URL="http://www.php.net/else"]else[/URL][COLOR= #007700]{[/COLOR]
    [URL="http://www.php.net/echo"]echo[/URL][COLOR= #DD0000] Naam is wel ingevuld[/COLOR][COLOR= #007700];
}[/COLOR]
?>
Dat heb ik al, kijk even goed. Ik krijg dan al direct dat hij zegt dat ik het niet heb ingevuld. Maar toch als ik op versturen druk zonder iets in te vullen zegt hij dat het lid is toegevoegd.

Dan is er iets anders mis met je code, zal even kijken.
Spoiler tonen
[COLOR= #0000BB]<?php[/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]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]signup[/COLOR][COLOR= #007700]])) {[/COLOR]
[COLOR= #0000BB]$signup_sql[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"INSERT INTO leden VALUES(,"[/COLOR][COLOR= #007700].[/COLOR]sqlsafe[COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]username[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000]","[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/md5"]md5[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]password[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000]","[/COLOR][COLOR= #007700].[/COLOR]sqlsafe[COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]rang[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000]")"[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$signup_sql[/COLOR] [COLOR= #007700]==[/COLOR] TRUE[COLOR= #007700]) {[/COLOR]
                          [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Lid succesvol toegevoegd!"[/COLOR][COLOR= #007700];
                          }[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
                          [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Error: Dit lid is niet succesvol aangemeld wegens: "[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]();
                          }
        }[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"<form method="POST" action="">
<table border="0" cellpadding="0" cellspacing="0" width="32%" id="table1">
        <tr>
                <td width="139">Naam</td>
                <td>
                        <p><input type="text" name="username" size="26"></p>
                </td>
        </tr>
        <tr>
                <td width="139">Wachtwoord:</td>
                <td><input type="text" name="password" size="26"></td>
        </tr>
        <tr>
                <td width="139">Rang:</td>
                <td><select  name="rang">
                <option>DJ</option>
                <option>Hoofd-DJ</option>
                <option>Support</option>
                <option>Manager</option>
                <option>Admin</option>
            </select></td>
        </tr>

        <tr>
                <td width="139">&nbsp;</td>
                <td><input type="submit" value="Verzenden" name="signup"></td>
        </tr>
</table>
</form>"[/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]username[/COLOR][COLOR= #007700]]) &&[/COLOR] [URL="http://www.php.net/empty"]empty[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]password[/COLOR][COLOR= #007700]])) {[/COLOR]
[URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]<div style="font-family:calibri;width:600px; text-align:center; margin-left:auto; margin-right:auto;margin-top:50px; padding:8px; border:1px solid #9c0006; background:#ffc7ce; color:#9c0006;"><strong>Foutmelding</strong> <br><br>Vul een gebruikersnaam en wachtwoord in!</div>[/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]username[/COLOR][COLOR= #007700]])) {[/COLOR]
[URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]<div style="font-family:calibri;width:600px; text-align:center; margin-left:auto; margin-right:auto;margin-top:50px; padding:8px; border:1px solid #9c0006; background:#ffc7ce; color:#9c0006;"><strong>Foutmelding</strong> <br><br>Vul een gebruikersnaam in!</div>[/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]password[/COLOR][COLOR= #007700]])) {[/COLOR]
[URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]<div style="font-family:calibri;width:600px; text-align:center; margin-left:auto; margin-right:auto;margin-top:50px; padding:8px; border:1px solid #9c0006; background:#ffc7ce; color:#9c0006;"><strong>Foutmelding</strong> <br><br>Vul een wachtwoord in!</div>[/COLOR][COLOR= #007700]);
}
}[/COLOR]
?>
Probeer dat eens
0
Thom

Lid

Berichten
10.654
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Bjarnootjuh schreef:
Hoe laat ik hem lege fields checken. Heb dit:
[COLOR= #0000BB]<?php[/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]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]signup[/COLOR][COLOR= #007700]])) {[/COLOR]
[COLOR= #0000BB]$signup_sql[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"INSERT INTO leden VALUES(,"[/COLOR][COLOR= #007700].[/COLOR]sqlsafe[COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]username[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000]","[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/md5"]md5[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]password[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000]","[/COLOR][COLOR= #007700].[/COLOR]sqlsafe[COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]rang[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000]")"[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$signup_sql[/COLOR] [COLOR= #007700]==[/COLOR] TRUE[COLOR= #007700]) {[/COLOR]
                          [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Lid succesvol toegevoegd!"[/COLOR][COLOR= #007700];
                          }[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
                          [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Error: Dit lid is niet succesvol aangemeld wegens: "[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]();
                          }
        }[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"<form method="POST" action="">
<table border="0" cellpadding="0" cellspacing="0" width="32%" id="table1">
        <tr>
                <td width="139">Naam</td>
                <td>
                        <p><input type="text" name="username" size="26"></p>
                </td>
        </tr>
        <tr>
                <td width="139">Wachtwoord:</td>
                <td><input type="text" name="password" size="26"></td>
        </tr>
        <tr>
                <td width="139">Rang:</td>
                <td><select  name="rang">
                <option>DJ</option>
                <option>Hoofd-DJ</option>
                <option>Support</option>
                <option>Manager</option>
                <option>Admin</option>
            </select></td>
        </tr>

        <tr>
                <td width="139">&nbsp;</td>
                <td><input type="submit" value="Verzenden" name="signup"></td>
        </tr>
</table>
</form>"[/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]username[/COLOR][COLOR= #007700]]) &&[/COLOR] [URL="http://www.php.net/empty"]empty[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]password[/COLOR][COLOR= #007700]])) {[/COLOR]
[URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]<div style="font-family:calibri;width:600px; text-align:center; margin-left:auto; margin-right:auto;margin-top:50px; padding:8px; border:1px solid #9c0006; background:#ffc7ce; color:#9c0006;"><strong>Foutmelding</strong> <br><br>Vul een gebruikersnaam en wachtwoord in!</div>[/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]username[/COLOR][COLOR= #007700]])) {[/COLOR]
[URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]<div style="font-family:calibri;width:600px; text-align:center; margin-left:auto; margin-right:auto;margin-top:50px; padding:8px; border:1px solid #9c0006; background:#ffc7ce; color:#9c0006;"><strong>Foutmelding</strong> <br><br>Vul een gebruikersnaam in!</div>[/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]password[/COLOR][COLOR= #007700]])) {[/COLOR]
[URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]<div style="font-family:calibri;width:600px; text-align:center; margin-left:auto; margin-right:auto;margin-top:50px; padding:8px; border:1px solid #9c0006; background:#ffc7ce; color:#9c0006;"><strong>Foutmelding</strong> <br><br>Vul een wachtwoord in!</div>[/COLOR][COLOR= #007700]);
}[/COLOR]
?>


Je bent niet zo heul slim he? yummieJe zet eerst iets in de database, en nadat je dat gedaan hebt check je pas of het ingevuld is? emo
toevoeging op 9 juni 2012, 19:08:36:
Probeer eens:
Spoiler tonen
[COLOR= #0000BB]<?php[/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]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]signup[/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]username[/COLOR][COLOR= #007700]]) &&[/COLOR] [URL="http://www.php.net/empty"]empty[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]password[/COLOR][COLOR= #007700]])) {[/COLOR]
            [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<div style="font-family:calibri;width:600px; text-align:center; margin-left:auto; margin-right:auto;margin-top:50px; padding:8px; border:1px solid #9c0006; background:#ffc7ce; color:#9c0006;"><strong>Foutmelding</strong> <br><br>Vul een gebruikersnaam en wachtwoord in!</div>[/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]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]username[/COLOR][COLOR= #007700]])) {[/COLOR]
            [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<div style="font-family:calibri;width:600px; text-align:center; margin-left:auto; margin-right:auto;margin-top:50px; padding:8px; border:1px solid #9c0006; background:#ffc7ce; color:#9c0006;"><strong>Foutmelding</strong> <br><br>Vul een gebruikersnaam in!</div>[/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]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]password[/COLOR][COLOR= #007700]])) {[/COLOR]
            [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<div style="font-family:calibri;width:600px; text-align:center; margin-left:auto; margin-right:auto;margin-top:50px; padding:8px; border:1px solid #9c0006; background:#ffc7ce; color:#9c0006;"><strong>Foutmelding</strong> <br><br>Vul een wachtwoord in!</div>[/COLOR][COLOR= #007700];
        }[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
            [COLOR= #0000BB]$signup_sql[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"INSERT INTO leden VALUES(,"[/COLOR][COLOR= #007700].[/COLOR]sqlsafe[COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]username[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000]","[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/md5"]md5[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]password[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000]","[/COLOR][COLOR= #007700].[/COLOR]sqlsafe[COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]rang[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000]")"[/COLOR][COLOR= #007700]);[/COLOR]
            [URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$signup_sql[/COLOR] [COLOR= #007700]==[/COLOR] TRUE[COLOR= #007700]) {[/COLOR]
                [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Lid succesvol toegevoegd!"[/COLOR][COLOR= #007700];
            }[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
                [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Error: Dit lid is niet succesvol aangemeld wegens: "[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]();
            }
        }
    }[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
    
?>
<form method="POST" action="">
<table border="0" cellpadding="0" cellspacing="0" width="32%" id="table1">
        <tr>
                <td width="139">Naam</td>
                <td>
                        <p><input type="text" name="username" size="26"></p>
                </td>
        </tr>
        <tr>
                <td width="139">Wachtwoord:</td>
                <td><input type="text" name="password" size="26"></td>
        </tr>
        <tr>
                <td width="139">Rang:</td>
                <td><select  name="rang">
                <option>DJ</option>
                <option>Hoofd-DJ</option>
                <option>Support</option>
                <option>Manager</option>
                <option>Admin</option>
            </select></td>
        </tr>

        <tr>
                <td width="139">&nbsp;</td>
                <td><input type="submit" value="Verzenden" name="signup"></td>
        </tr>
</table>
</form>
[COLOR= #0000BB]<?php[/COLOR]
        [COLOR= #007700]}[/COLOR]
?>
0
Berichten
7.806
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Jup, het werkt! Dank je Thommity
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