Hello. I'm new to this forum. I have started a project for school, in creating a database with MySQL and a user interface with php. The problem is that for some reason it does not want to work.....its hard to explain....ill link the code:
<?php
//create database connection
$dbhost = "localhost";
$dbuser = "linux_kb_boss";
$dbpass = "password";
$dbname = "linux_kb";
$connection = mysqli_connect($dbhost, $dbuser, $dbpass, $dbname);
//testing if connection worked
if(mysqli_connect_errno()){
die("Database Connection Failed: " . mysqli_connect_error() . "(" . mysqli_connect_errno() . ")" );
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Linux CREATE Page</title>
</head>
<body>
<form method="post">
<fieldset>
<legend>Title:</legend>
<input type="text" name="textTitle" style="width: 500px" />
</fieldset>
<br />
<fieldset>
<legend>Keyword:</legend>
<input type="text" name="textKeywords" style="width: 500px"/>
</fieldset>
<br />
<fieldset>
<legend>Description</legend>
<textarea name="textContent" rows="20" cols="90"></textarea>
</fieldset>
<br />
<input type="submit" name="submit" value="Create KB Entry" style="width: 800px" />
</form>
<br />
<?php
//submit button press action
if(isset($POST['submit'])){
$title = $POST['textTitle'];
$keyw = $POST['textKeywords'];
$desc = $POST['textContent'];
$vis = 1;
$query = "INSERT INTO content (title_name, visible, content, words) VALUES ('{$title}', {$vis}, '{$desc}', '{$keyw}')";
$result = mysqli_query($connection, $query);
//testing query error
if($result){
echo "Success!";
}
}
?>
</body>
</html>
When i try to enter the title, keyword and description ....it does not echo on the screen anything. And in MySQL i check if there is any new row's added with 'SELECT * FROM content' (content is the table name) and nothing was added....
Could someone please help me find the error in this little project?