Phpmyadmin (xampp for Windows) will not save data from perfectly good PHP and HTML code:
<html>
<?php
$news = $_POST['news'];
$con = mysql_connect['127.0.0.1','root',''];
mysql_select_db($con, 'chidon')
$select="INSERT INTO `news`(`news`) VALUES ([$news]";
mysql_query($con, $select);
?>
<head>
<meta charset="utf-8">
</head>
<body>
<form action='webpage.html' method="POST">
<div>
<h4>News:</h4><input type="text" name="news">
<input type="submit" name="submit" value="SUBMIT">
</body>
</html>
So please help me because it's very frustrating... Thanks.
Absolutely nothing about this is "perfectly good".
mysql_*
functions are deprecated, you need to use PDO or MySQLi.
$con = mysql_connect['127.0.0.1','root',''];
Should be (albeit not a mysql_*
function):
$con = mysql_connect('127.0.0.1','root','');
This line:
mysql_select_db($con, 'chidon')
Should have a semicolon at the end:
mysql_select_db($con, 'chidon');
This line:
$select="INSERT INTO `news`(`news`) VALUES ([$news]";
Should be:
$select="INSERT INTO `news`(`news`) VALUES ('$news')";
...and should use prepared statements (available in MySQLi and PDO libraries).
Finally:
<form action='webpage.html' method="POST">
Doesn't make any sense, how are you expecting to use the data if you're posting to a HTML file? You probably mean webpage.php
, and might need to change your file extension to match this too.
Also, this has nothing to do with PHPMyAdmin, PHPMyAdmin is just a tool used to access and manipulate a MySQL database, it's not the actual database itself.