insert.php
<?php
mysql_connect("localhost","root",""); mysql_select_db("basic");
$name=$_POST['fname'];
$twait=$_POST['twait'];
$cprice=$_POST['cprice'];
$dprice=$_POST['dprice'];
$order= "INSERT INTO calculator
(name,total_wt,crt_price,dollar_rate) VALUES
('$name','$twait','$cprice','$dprice')";
$result = mysql_query('$order');
echo "Done";
?>
HTML page:
<!DOCTYPE html>
<html>
<head>
<title>JN DIAMONDS</title>
</head>
<body>
<form align="center" method="POST" action="insert.php">
<fieldset>
<legend>Info</legend><br>
<input type="text" name="fname" placeholder="Name"><br><br>
<input type="text" name="twait" placeholder="Total Rough Weight"><br><br>
<input type="text" name="cprice" placeholder="1 Carat Price"><br><br>
<input type="text" name="dprice" placeholder="Dollar Rate"><br><br>
<input type="submit" name="submit"value="Submit"><br>
</fieldset>
</form>
</body>
</html>
$result = mysql_query($order);And stop using mysql it is deprecated instead usemysqli or PDOmysqli or PDOwith bound parameters, which is a bad idea not to, at least don't directly put variable unsanitized into the sqlmysql_has been deprecated since PHP 5.5 and removed in PHP 7. Usingmysql_leaves you wide open to sql injection attacks. Soon your code will stop functioning completely and you'll be back asking a question like this. Start learning pdo_mysql. When your host upgrades to PHP 7, you will be so happy you did.