i dont know whats wrong with my codes. kinda new to PHP
here is my html code
<html>
<body>
<form action="sample2.php" method="POST">
<input type="submit" value="occupied" id="occupied">
<input type="submit" value="reserved" id="reserved">
<a name="slot1" style="background-color: green; width:100px; height:100px; border-top-right-radius:0px; border: 2px
solid Black;float:left; position:absolute; top:400px; left:441px;">
</form>
</body>
</html>
PHP code is here
<?php
$con=mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("sample");
if(isset($_POST['occupied'])){
$query="UPDATE reservation SET status='occupied' where status='vacant'";
echo "<a style=background-color: red; width:100px; height:100px; border-top-right-radius:0px; border: 2px
solid Black;float:left; position:absolute; top:400px; left:441px;>";
}
?>
my problem is whenever i click the occupied button, the color of the box doesnt change from green to red, it only directs me to a blank page. help
nameattribute on your HTML form elements. But hopefully you also know that when you click the button, the page redirects tosample2.phpand all that exists on that page (based on your sample) is a link. No<html>tag, no<body>tag, no<form>element, no<input>elements...just a link, and that's it. Is that what you want?set_ini('display_errors', 1), so you can track the error.!