Hi
My website is sems1.000webhostapp.com
I want to insert a course name without refreshing the page into the database…
The file names in my website are
insert.php a form to insert the value
ajax.php is where the insertion operation takes place
The code in insert.php is
The code in ajax.php is
<?php
$conn=mysqli_connect("localhost","id3581319_srini","srini","id3581319_test");
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
$sql = "INSERT INTO `programs`(`cid`) VALUES('$_POST['couseid']')";
if(mysqli_query($conn, $sql))
{
echo "Your Response has been successfully updated to our database";
}
else
{
echo"Not updated";
}
?>
Under sems1.000webhostapp.com/insert.php
There will be only one input text field and a button.
The function which triggers the button is shown in the above picture