I used the folowing website towards the end of the website http://zetcode.com/databases/sqlitephptutorial/ to make a connection to the sqlite database using PHP. Working on netbeans and have imported the appropriate driver and jar files however clicking submit on html is not doing the job and simply prints the whole php file.
Heres my html and php...
<?php
$id= (int)rand(1,9999999);
$name = $_POST['name'];
$CompanyName = $_POST['CompanyName'];
$number = $_POST['number'];
$Address = $_POST['Address'];
$Emailaddress = $_POST['Emailaddress'];
$pwd = $_POST['pwd'];
$business = $_POST['business'];
$Monthlyspend = $_POST['Monthlyspend'];
$products = $_POST['products'];
$industry = $_POST['industry'];
$customers = $_POST['customers'];
$info = $_POST['info'];
$name_es = sqlite_escape_string($name);
if (!empty($name)) {
$dbhandle = sqlite_open('RegisterNewcustomer', 0666, $error);
if (!$dbhandle) die ('Could not find database');
$stm = "INSERT INTO Registercustomers(ID,name,CompanyName,number,EmailAddress,business,Monthlyspend,products,customers,info,password,industry) VALUES('$id', '$name_es', '$CompanyName', '$number', '$Address', '$Emailaddress', '$business', '$Monthlyspend', '$products', '$customers', '$info', '$pwd', '$industry')";
$ok = sqlite_exec($dbhandle, $stm, $error);
if (!$ok) die("Error: Cannot Execute Query");
echo "Form Submitted Successfully";
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Register New account </title>
</head>
<body>
<h1> Register a New Account </h1>
<p> To register a new Account, Please fill in the form below alternatively you can call the customer services team<br />
at Alliance Healthcare at <strong>020 8391 2323</strong> to enquire about opening a new account.<br />
</p>
<form name="RegisterNewaccount" method="POST" action="form.php">
<fieldset>
<legend>
Your Details:
</legend>
<p><label> Name:<br>
<input type="text" name="name" size="30" maxlength="50"/></label> </p><br>
<p> <label> Company Name: <br>
<input type="text" name="CompanyName" size="30" maxlength="50"/> </label></p> <br>
<p> <label> Contact Number:<br>
<input type="text" name="number" size="30" maxlength="50"/></label> </p><br>
<p> <label> Address:<br>
<input type="text" name="Address" size="30" maxlength="50"/> </label> </p><br>
<p> <label> Please enter a valid Email Address: <br>
<input type="text" name="Emailaddress"> </label></p> <br>
<p> <label> Please Choose a Password: <br><input type ="password" name="pwd"/> </label> </p><br>
<p> <label> Type of Business:</label> <br>
<select name="business">
<option value="Community pharmacy">Community Pharmacy </option>
<option value="Hospital Pharmacy">Hospital Pharmacy</option>
<option value="Dispensing Doctor"> Dispensing Doctors</option>
<option value="Non Pharmacy/Wholesaler">Non Pharmacy/Wholesaler</option>
</select> </p>
<p> <label> Approximately how much would your monthly spend be:<br><input type="text" name="Monthlyspend"> </label> </p><br>
<p> <label>What products are you interested in purchasing:</label> </p>
<input type="checkbox" name="products" value="Almus"/> Almus
<input type="checkbox" name="products" value="Health and Beauty Products"/> Health & Beauty Products
<input type="checkbox" name="products" value="Prescription Medicine"/> Prescription Medicine <br>
<p><label> What sector of the industry do you operate in? :<br> <input type="text" name="industry"> </label> </p> <br>
<p> <label> Who are your customers? </label></p>
<textarea rows="4" cols ="20" name="customers"> </textarea>
<p> <label>How did you find out about Alliance Healthcare ? </label> <br>
<textarea rows="3" cols="50" name="info"> </textarea></p>
<input name="Submit" type="submit" value="Submit" />
</fieldset>
</form>
</body>
</html>