My idea is to fill out entries in an HTML form, then save the info to the database (phpmyadmin). Then display the info on google map (exporting).
But it's not working because of a syntax and a logical issue.
My HTML form:
<html>
<head></head>
<body>
<form method="POST" action="../BackEnd/ShopSetup.php" name="Setup">
<td>Name</td>
<td>
<input type="text" name="name"></td>
</tr>
<tr>
<td>type</td>
<td>
<input type="varchar" name="type"></td>
</tr>
<tr>
<td>Address</td>
<td>
<input type="text" name="address"></td>
</tr>
<tr>
<td>Email</td>
<td>
<input type="email" name="email"></td>
</tr>
<tr>
<td>Phone Number</td>
<td>
<input type="varchar" name="phone"></td>
</tr>
<tr>
<td>longitude</td>
<td>
<input type="float" name="long"></td>
</tr>
<tr>
<td>latitude</td>
<td>
<input type="float" name="lat"></td>
</tr>
<tr>
<td>Opening Hour</td>
<td>
<input type="varchar" name="opening"></td>
</tr>
<tr>
<td>Closing Hour</td>
<td>
<input type="varchar" name="closing"></td>
</tr>
<tr>
<td>
<input id="button" type="submit" name="submit" value="Setup"></td>
</tr>
<tr></tr>
</form>
</body>
</html>
My PHP Page On the BackEnd:
ShopSetup.php
<?php include ("../Connections/Connection.php"); if (isset($_POST["submit"])) { $name = $_POST["name"]; $type = $_POST["type"]; $address = $_POST["address"]; $email = $_POST["email"]; $phone = $_POST["phone"]; $long = $_POST["long"]; $lat = $_POST["lat"]; $opening = $_POST["opening"]; $closing = $_POST["closing"]; $sql = "INSERT INTO locations (name, type, address, email, phone, long, lat, opening, closing) VALUES('$name', '$type', '$address', '$email', '$phone', '$long', '$lat', '$opening', '$closing')"; $query = mysql_query($sql); if (!$query) { die ("Error : " . mysql_error()); } if(empty($name) || empty($type) || empty($address) || empty($email) || empty($phone) || empty($long) || empty($lat) || empty($opening) || empty($closing)) { echo "You did not fill out the required fields."; die(); // Note this } echo "<center></center>"; } ?> <h1> Your order is complete!</h1> <p class="intro-text">You will see your shop on the map soon<br></p> <center> <h3> <a href="../index.php"> go to home page </a></h3> </center>
But when I submit the form I get:
Error : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'long, lat, opening, closing) VALUES('', '', '', '', '', '', '', '', '')' at line 1
What is the best HTML attribute to save opening/closing times: weeks, days. hours, minutes, seconds?