I have just got a new machine, set up Apache, PHP and MySQL. In the sites I have created, I can pull data out of MySQL, but not post anymore.
I even set up an icedibly basic page to test, and even that doesn't work. The form sits there and refeshes and the POST writes in the address bar, by MySQL does not update. Any ideas? Basic code below
<?php
// Test for user input
if (empty($field1) || empty($field2) || empty ($field3))
{
?>
<form method="GET" action="post_test.php">
<table>
<tr><td><input type="text" name="field1" class="input"></td></tr>
<tr><td><input type="text" name="field2" class="input"></td></tr>
<tr><td><input type="text" name="field3" class="input"></td></tr>
<tr><td><input type="submit" class="inputButton" value="Log Call"></td></tr>
</table>
</form>
<?php
}
else
{
if (!($connection = @ mysql_connect($hostname,
$username,
$password)))
die("Could not connect to database");
if (!mysql_select_db("helpdesk", $connection))
showerror();
$insertQuery = ("INSERT INTO test VALUES ('$field1', '$field2', '$field'");
if ((@mysql_query ($insertQuery,
$connection))
&& @ mysql_affected_rows() == 1)
echo '<h5>Posted successfully - Thank you</h5>';
else
showerror();
}//if else empty()
?>