Hoi,
Dit hoort toch te werken? (hoe bagger het ook is)
Persoon_Toevoegen.php
Codeblok (Persoon_Toevoegen.php):
1
2
3
4
5
6
7
8
9
10
include "db_connect.php"; //verbinding maken
$query = "INSERT INTO `personen` (`naam` , `straat` , `huisnummer` , `postcode` , `stad` , `land` )
VALUES ( $_POST[naam];, $_POST[straat];, $_POST[huisnummer];, $_POST[postcode];, $_POST[stad];, $_POST[land]
";
//query is aangemaakt
$sql = mysql_query($query);
//query is uitgevoerd
?>
Codeblok (persoon_toevoegen.html):
1
2
3
4
5
6
7
8
9
10
Codeblok (db-connect.php):
1
2
3
4
5
6
7
8
9
10
$server = "localhost";
$gebruiker = "user";
$wachtwoord = "password";
$db = "dbt";
// Connect to server and select database.
mysql_connect("$server", "$gebruiker", "$wachtwoord")or die("ERROR #107: Cannot connect, contact the website owner.");
mysql_select_db("$db")or die("ERROR #207: Cannot connect, contact the website owner.");
?>
Alvast bedankt.
Dit hoort toch te werken? (hoe bagger het ook is)
Persoon_Toevoegen.php
Codeblok (Persoon_Toevoegen.php):
1
2
3
4
5
6
7
8
9
10
include "db_connect.php"; //verbinding maken
$query = "INSERT INTO `personen` (`naam` , `straat` , `huisnummer` , `postcode` , `stad` , `land` )
VALUES ( $_POST[naam];, $_POST[straat];, $_POST[huisnummer];, $_POST[postcode];, $_POST[stad];, $_POST[land]
";//query is aangemaakt
$sql = mysql_query($query);
//query is uitgevoerd
?>
Codeblok (persoon_toevoegen.html):
1
2
3
4
5
6
7
8
9
10
Codeblok (db-connect.php):
1
2
3
4
5
6
7
8
9
10
$server = "localhost";
$gebruiker = "user";
$wachtwoord = "password";
$db = "dbt";
// Connect to server and select database.
mysql_connect("$server", "$gebruiker", "$wachtwoord")or die("ERROR #107: Cannot connect, contact the website owner.");
mysql_select_db("$db")or die("ERROR #207: Cannot connect, contact the website owner.");
?>
Alvast bedankt.
