I’m building a site which includes a part for the administrator to add users and view all users in the system.
I don’t have much experience with PHP, so I might got stuck on a very simple or stupid thing, anyway: I can’t solve it.
The page can be found at [url]http://reynearts.awardspace.com
When I try to add a user, it just doesn’t work.
Where do I go wrong?
[code]
<?php
include(“../Scripts/dbconnect.php”);
?>
<html>
<head>
<title></title>
<link rel=”Stylesheet” type=”text/css” href=”CSS/admin.css”>
</head>
<body>
<table>
<tr><td class=”useradminleft”>
<?php
if ($toevoegen && $Gebruiker && $wachtwoord && $Voornaam && $Tussenvoegsel && $Achternaam) {
$toevoegquery = “INSERT INTO login (username, password, Voornaam, Tussenvoegsel, Achternaam) VALUES(‘$Gebruiker’, ‘$wachtwoord’, ‘$Voornaam’, ‘$Tussenvoegsel’, ‘$Achternaam’)”;
if (!mysql_query($toevoegquery)) {
echo “Toevoegen mislukt!”;
exit;
} else {
echo “Gebruiker toegevoegd!”;
exit;
}
}
?>
Gebruikers toevoegen<br><br>
<form name=”adduser” method=”post” action=”<?php echo $PHP_SELF ?>”>
Gebruikersnaam:
<input type=”text” name=”Gebruiker” value=””><br>
Wachtwoord:
<input type=”text” name=”wachtwoord” value=”fotosite”><br>
Voornaam:
<input type=”text” name=”Voornaam” value=””><br>
Tussenvoegsel:
<input type=”text” name=”Tussenvoegsel” value=””><br>
Achternaam:
<input type=”text” name=”Achternaam” value=””><br>
<input type=”Submit” name=”toevoegen” value=”gebruiker aanmaken”>
</form>
</td>
<td class=”useradminright”>
Gebruikersoverzicht<br><br>
<?php
$overzichtquery = “SELECT * FROM login”;
$overzicht = mysql_query($overzichtquery);
while ($rij = mysql_fetch_array($overzicht)) {
echo $rij[“username”].” ”;
echo $rij[“active”].” ”;
echo $rij[“Voornaam”].” ”;
echo $rij[“Tussenvoegsel”].” ”;
echo $rij[“Achternaam”].” ”;
}
?>
</td></tr>
</table>
</body>
</html>
<?php
include(“../Scripts/dbclose.php”);
?>