I built an html page with some options to insert details for a friends club. I used an INSERT query and it worked. I want to add other queries like an UPDATE, DELETE, SELECT etc.
this is the php file:
<?php
//Input posted data.
$Fname = $_POST["Fname"];
$Lname = $_POST["Lname"];
$Date = $_POST["Date"];
$Mail = $_POST["Mail"];
$Pass = $_POST["Pass"];
// Create connection
$conn = mysqli_connect('localhost','root',"");
//Check if the connection was opened, if not prompt the error to the page.
if (!$conn)
{
die('Could not connect: ' . mysqli_error());
}
//Select the data base.
mysqli_select_db($conn, "club");
//Set the character set to utf-8 to allow hebrew.
mysqli_query($conn, "SET NAMES 'utf8'");
//SQL query - user Details
$sql = "INSERT INTO customers (Fname, Lname, Mail, Date, Pass)
VALUES('$Fname','$Lname','$Mail','$Date','$Pass')";
//Run SQL query
$results = mysqli_query($conn, $sql) or die (mysqli_connect_errno());
//Close the SQL connection.
mysqli_close($conn);
?>
I want to use those queries in the same file.
how can I do that?
Should I add a new form on the same page?
For example <form name="input" action="Update.php" method="POST">
to direct it to the Update.php
file?
can I use more than one form at the same html file?
I've created this form for the Update button on the page to Update.php
file but it doesn't work. It just adds the details and does not update them, although I used the UPDATE query.