Tuurlijk, voor de mensen die nu PHP leren, welke TUT gebruiken jullie? Ikzelf phptuts.nl/view/39
Kleine Vragen Topic #1
TIP: Leren van uit bestaande scripts lijkt mij het beste! Nu kan ik al 2 maanden redelijk PHP
Uit welke scriptd leer jij dan?
Ik doe het ogeveer uit beide.
Ik doe het ogeveer uit beide.
Hoe kom je aan je IP adres als CIDR notatie of iets dergelijks? Al op google opgezocht maar kan het niet vinden
Sanderc schreef:Er bestaan miljoenen scripts.. kies er eentje uit zou ik zeggenUit welke scriptd leer jij dan?
Ik doe het ogeveer uit beide.
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.
//ohnee, ik snap het al. Je browser leest alleen de output.
Rogier schreef:Die klopt niet helemaal.= definieren
== vergelijken
=== vergelijken BOOLEAN
! niet gelijk aan
>= groter || gelijk aan
<= kleiner || gelijk aan
> groter
< kleiner
=== 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.
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"> </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]
?> 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"> </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?
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.
[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]
?> Sanderc schreef: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.[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] ?>
Bjarnootjuh schreef: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.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] ?>
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"> </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]
?>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"> </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?
Je zet eerst iets in de database, en nadat je dat gedaan hebt check je pas of het ingevuld is? 
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"> </td>
<td><input type="submit" value="Verzenden" name="signup"></td>
</tr>
</table>
</form>
[COLOR= #0000BB]<?php[/COLOR]
[COLOR= #007700]}[/COLOR]
?>Jup, het werkt! Dank je Thommity