I'm trying to build an html form and connecting it to a php file which is doing the query and insert the information to mysql database.
Here is my html code:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Add Record Form</title>
</head>
<body>
<form action="/joomla_31/insert.php" method="post">
<label for="MGMT_IP">MGMT IP</label>
<input type="text" name="MGMT_IP" id="MGMT_IP">
</p>
<p>
<label for="Vendor">Vendor</label>
<input type="text" name="Vendor" id="Vendor">
</p>
<p>
<label for="Version">Version</label>
<input type="text" name="Version" id="Version">
</p>
<p>
<label for="GUI_User">GUI User</label>
<input type="text" name="GUI_User" id="GUI_User">
</p>
<p>
<label for="GUI_Pass">GUI Pass</label>
<input type="text" name="GUI_Pass" id="GUI_Pass">
</p>
<input type="submit" value="submit">
</form>
</body>
</html>
And Here is my insert.php file:
<?php
$link = mysqli_connect("localhost", "root", "", "mysql");
// Check connection
if($link === false){
die("ERROR: Could not connect. " . mysqli_connect_error());
}
// Escape user inputs for security
$MGMT_IP = mysqli_real_escape_string($link, $_REQUEST['MGMT IP']);
$Vendor = mysqli_real_escape_string($link, $_REQUEST['Vendor']);
$Version = mysqli_real_escape_string($link, $_REQUEST['Version']);
$GUI_User = mysqli_real_escape_string($link, $_REQUEST['GUI User']);
$GUI_Pass = mysqli_real_escape_string($link, $_REQUEST['GUI Pass']);
// attempt insert query execution
$sql = "INSERT INTO `cloud_team` (MGMT IP, Vendor, Version, GUI User, GUI Pass) VALUES (`$customer_number`, `$customer_name`, `$MGMT_IP`, `$Vendor`, `$Version`, `$GUI_User`, `$GUI_Pass`)";
if(mysqli_query($link, $sql)){
echo "Records added successfully.";
} else{
echo "ERROR: Could not able to execute $sql. " . mysqli_error($link);
}
// close connection
mysqli_close($link);
?>
But every time I click on the submit button I get a blank page ... It is like it is redirecting the correct file (http://x.x.x.x/joomla_31/insert.php) .. but nothing executed ...no error displayed .. only a blank page