I am building a webpage that inlcude entering data into a databse. I am successfully connecting to my database, and my insert query is working as far as it is adding rows into the database, but the form data is not getting pass across so the rows are being created ( I have seen them in phpmyadmin) but the data is empty.
I have two pages. One for displaying the form, and one that receive sthe form data and runs the sql query.
This is the data for the form webpage
<body>
<form action="insert.php" method=”post”>
Venue:
<input type="text" name = "venue">
<br>
Date:
<input type="text" name = "date">
<br>
Time:
<input type="text" name = "time">
<br>
Postcode:
<input type="text" name = "postcode">
<br>
<input type="submit" Value = "submit" name= "submit">
</form>
This is the code that I am using for entering the data. I have not included the connection code for the database as I am not having a problem with this.
$venue = $_POST['venue'];
$date = $_POST['date'];
$time = $_POST['time'];
$postcode = $_POST['postcode'];
$query = "INSERT into `event`(`eventVenue`, `eventDate`, `eventTime`,
`EventPostCode`) VALUES ( '$venue', '$date','$time', '$postcode' )";
mysqli_query($dbconn, $query);
<hr>
</body>
Db Connection:
$host="50.62.209.87"; // Host name
$username="************"; // Mysql username
$password="********"; // Mysql password
$db_name="extras"; // Database name
// Connect to server and select databse.
$dbconn = mysqli_connect($host, $username, $password)or die("cannot connect");
mysqli_select_db($dbconn, $db_name)or die("cannot select DB");
" in the php area?
– Charles Forest Feb 08 '15 at 17:11