I'm having problems with inserting into a database. the query completes successfully but when I look in the database the fields are empty.
Here's my HTML form:
<form action = "add_at.php" method = "post">
<input type = "text" class = "userip" name="userip">
<input type = "text" class = "coordinates" name="coordinates">
<input type = submit>
</form>
Here's my php script:
<?php
$mysql_host ='host';
$mysql_user ='user';
$mysql_pass ='pass';
$mysql_database = 'database';
$user_ip = $_POST['userip'];
$user_cords = $_POST['coordinates'];
mysql_connect($mysql_host, $mysql_user, $mysql_pass) or die('unable to connect.');
mysql_select_db($mysql_database);
$query = "INSERT INTO `userips` (ip,cord) VALUES ('$user_ip','$user_cords')";
mysql_query($query) or die('nope, sorz.');
mysql_close();
echo('woot wooooooooooooot')
?>
Update:
I found the problem. I needed to add a \ to one of my input fields in my HTML form. Simple mistake. Thank you all for your help, though.