I'm having a html form where i have 3 fields(ID, NAME, BLOOD GROUP). And below that I've 3 buttons(INSERT, UPDATE, DELETE). And then i want to enter the values in the fields and when click on the INSERT button these values should be entered into a table through a PHP script. Similar respective actions must happen with UPDATE and DELETE also. Can anyone help me out?
<?php
$dbhost = 'localhost';
$dbuser = 'root';
$dbpass = '';
$conn = mysql_connect($dbhost, $dbuser, $dbpass);
if (!$conn) {
die("couldn't connect" . mysql_error());
}
echo 'connected successfully';
mysql_select_db('DB');
$id = $_POST['Id'];
$name = $_POST['Name'];
$blood = $_POST['BloodGroup'];
$order = "Insert into info(Id, name, BloodGroup) values ('$Id', '$Name', '$BloodGroup')";
$result = mysql_query($order);
if (!$result) {
die('Input data failed' . mysql_error());
}
echo 'Input data entered successfully';
mysql_close($conn);