Beste Thomas,
Dank je wel voor je reactie, ik ben een beginner en misschien heb ik wel te hoog gegrepen. Maar voor alsnog doe de website wat ik wil. Een woord ingeven, de uitspraak, de betekenis en het gebruik van het woord. Dit maakt bij het leren van een taal eenvoudig,(waar ik nu mee bezig ben). Toen dacht ik, als ik dat voor Bahasa Indonesisch doe, dan kan ik dat ook voor Chinees doen. Maar back to the point, hoop dat iemand iets mee kan, dank weer voor je input...
- De character encoding is UTF-8
- De tekst wordt in een tabel weer gegeven op de website.
- Verbinding maken met de database op de mijn bekende manier
<?php
$db_host = "localhost";
$db_username = "gebruiker";
$db_pass = "password";
$db_name = "dagwoord";
?>
In dit deel worden de gegevens opgeslagen
=========
<?php
if(isset($_POST['submit'])){
$data_missing = array();
if(empty($_POST['word'])){
// Adds name to array
$data_missing[] = 'Word';
} else {
// Trim white space from the name and store the name
$word = trim($_POST['word']);
}
if(empty($_POST['pronounce'])){
// Adds name to array
$data_missing[] = 'Pronounce';
} else {
// Trim white space from the name and store the name
$pronounce = trim($_POST['pronounce']);
}
if(empty($_POST['meaning'])){
// Adds name to array
$data_missing[] = 'Meaning';
} else {
// Trim white space from the name and store the name
$meaning = trim($_POST['meaning']);
}
if(empty($_POST['example1'])){
// Adds name to array
$data_missing[] = 'Example1';
} else {
// Trim white space from the name and store the name
$example1 = trim($_POST['example1']);
}
if(empty($_POST['example2'])){
// Adds name to array
$data_missing[] = 'Example2';
} else {
// Trim white space from the name and store the name
$example2 = trim($_POST['example2']);
}
if(empty($_POST['example3'])){
// Adds name to array
$data_missing[] = 'Example3';
} else {
// Trim white space from the name and store the name
$example3 = trim($_POST['example3']);
}
if(empty($data_missing)){
require_once('../connect.php');
$query = "INSERT INTO wotd_id (id, word, pronounce, meaning, example1, example2, example3, date) VALUES (?, ?, ?, ?, ?, ?, ?, ?) ";
$stmt = mysqli_prepare($link,$query);
mysqli_stmt_bind_param($stmt, "ssssssss", $id, $word, $pronounce, $meaning, $example1, $example2, $example3, $date);
mysqli_stmt_execute($stmt);
$affected_rows = mysqli_stmt_affected_rows($stmt);
if($affected_rows == 1){
echo "<br /><br /><strong><center>";
echo 'Your Daily Word is succesfully added!';
echo "</strong></center>";
mysqli_stmt_close($stmt);
mysqli_close($link);
} else {
echo 'Error Occurred<br />';
echo mysqli_error($link);
mysqli_stmt_close($stmt);
mysqli_close($link);
}
} else{
echo "<br /><strong><center>";
echo 'The following data is missing: <br /> <br />';
echo "</strong></center>";
foreach($data_missing as $missing){
echo "<strong><center>";
echo "$missing";
echo "</strong></center>";
}
}
}
?>
[size=xsmall]
Toevoeging op 09/07/2016 17:35:24:[/size]
Nog even hoe het ingesteld staat binnen phpMyAdmin
[img]
http://i.imgur.com/lTx8orL.png[\img]