I created a php insert page connected to a phpmyadmin database in xxamp. The page was working fine but when i went to run it today it wouldn't work i think i may have done some thing to the code but not sure.
<?php $connect = mysqli_connect("localhost","root","","ria") or die("Connection error");
?>
php connect
<?php
if (isset($_POST['required'])) {
include ('connectmysqli.php');
$title = $_POST['title'];
$cost = $_POST['cost'];
$stock = $_POST['no in stock'];
$insert = "INSERT INTO book (title, cost, no in stock) VALUES ('$title', '$cost', '$stock')";
if (!mysqli_query($connect, $insert)){
die('Cant Insert New Record');
}
$newrecord = "New record added";
}
?>
insert record
<form action="addbook.php" method="post">
<input type="hidden" name="required" value="true" />
<fieldset style="width:50px" align="center">
<legend>Insert New Book</legend>
<label>Title:
<input type="text" name="title" /></label>
<br />
<br />
<label>Cost:
<input type="text" name="cost" /></label>
<br />
<br />
<label>Stock:
<input type="text" name="no of stock" />
</label>
<br />
<br />
<input type="submit" value="Submit" />
</fieldset>
</form>
html form
<?php
echo $newrecord
?>
echo
Does any one have any idea what I have done wrong with this It look me a few days to get working and now it has broken again.