I have been trying to get this to work for a while now, I'm trying to get my web app to write to my Azure database. I currently have this code as my html form:
<form method="get" id="form1" action="../Scripts/addproduct.php">
<table class="add-table">
<tr>
<!--Product ID field-->
<td>Product ID</td>
<td><input id="PID" type="number" style="width: 100%;"></td>
</tr>
<tr>
<!--Product Name field-->
<td>Product Name</td>
<td><input id="PName" type="text" style="width: 100%;"></td>
</tr>
<tr>
<!--Product Catagory field-->
<td>Product Catagory</td>
<td><input id="PCat" type="text" style="width: 100%;"></td>
</tr>
<tr>
<!--Product Price field-->
<td>Product Price</td>
<td><input id="PPrice" type="text" style="width: 100%;"></td>
</tr>
</table>
<!--Submit button-->
<input id="Submit1" type="submit" value="Submit" />
</form>
This is the code in my PHP file: (personal info replaced with hashtags)
<?php
$username = "##";
$password = "##";
$database = "##";
$servername = "tcp:##,1433";
$conn = new PDO($servername, $database, $username, $password);
// Assigns the value of the form elements to a PHP value
$productid = $_GET["PID"];
$productname = $_GET["PName"];
$productcatagory = $_GET["PCat"];
$productprice = $_GET["PPrice"];
$sql = "INSERT INTO Products VALUES ('$productid', '$productname', '$productcatagory', '$productprice')";
exit()
?>
Any help would be appreciated! EDIT: Forgot to add my insert code