So I have a database that contains a column with the name location and I want to use it to post on my webpage where I am. I also want a simple form that will allow me to quickly change that cell to whatever I want. I've looked at several examples and it all looks so clear, but it is NOT working!
<html><body>
<?php
$connection = mysql_connect ("localhost", "bjamin", "$pass") or die ('Error: ' .mysql_error());
if ($submit=="submit"){
$query ="UPDATE info.location SET now='Home'";
$result = mysql_query ($query,$connection);
mysql_close ($connection);
}
else{
?>
<form method="post" action="myloc.php">
Enter location:
<input type="text" name="location"></input><br>
Enter password
<input type="password" name="pass"></input><br>
<input type="submit" name="submit" value="submit"></input>
</form>
<?php
}
?>
</body></html>
Please help me. Once i click submit, the form just reappears. Shouldn't it then just show a blank page? And shouldn't the database be updated?