我无法让它工作,它没有将数据发布到数据库,我对此完全陌生,任何帮助都很棒!
<?php
$connection = mysql_connect('server', 'user', 'pass') or die(mysql_error());
mysql_select_db('db') or die(mysql_error());
$client = $_POST['client'];
$date = $_POST['date'];
$amount = $_POST['amount'];
$sql = "INSERT INTO $sales (client, date, amount) VALUES ('$client', '$date', '$amount')";
$result = mysql_query($sql, $connection);
if ($result) {
echo "Successful";
echo "<BR>";
echo "<a href='insert.php'>Back to main page</a>";
} else {
echo "ERROR";
}
?>