15.08.2013, 03:08
I created a script which gets the information from the HTML forms and inserts into the MySQL database using PHP, but I doesn't work quite well, It doesn't upload the data into the database. Could someone please help me out?
Before anyone asks. The connection is all good.
Before anyone asks. The connection is all good.
PHP код:
<?php
include 'connect.php';
$time1 = "";
$time2 = "";
$time3 = "";
$time4 = "";
$time5 = "";
$time6 = "";
$time7 = "";
$time8 = "";
$time9 = "";
$time10 = "";
$time11 = "";
$time12 = "";
if(isset($_GET['time1'])){$time1 = $_GET['time1'];}
if(isset($_GET['time2'])){$time2 = $_GET['time2'];}
if(isset($_GET['time3'])){$time3 = $_GET['time3'];}
if(isset($_GET['time4'])){$time4 = $_GET['time4'];}
if(isset($_GET['time5'])){$time5 = $_GET['time5'];}
if(isset($_GET['time6'])){$time6 = $_GET['time6'];}
if(isset($_GET['time7'])){$time7 = $_GET['time7'];}
if(isset($_GET['time8'])){$time8 = $_GET['time8'];}
if(isset($_GET['time9'])){$time9 = $_GET['time9'];}
if(isset($_GET['time10'])){$time10 = $_GET['time10'];}
if(isset($_GET['time11'])){$time11 = $_GET['time11'];}
if(isset($_GET['time12'])){$time12 = $_GET['time12'];}
mysqli_query($con,"INSERT INTO schedule (`9:00AM`,`10:00AM`,`10:00AM`,`11:00AM`,`1:00PM`,`2:00PM`,`3:00PM`,`4:00PM`,`5:00PM`,`6:00PM`,`7:00PM`,`8:00PM`,`9:00PM`,`comment`)
VALUES ('$time1','$time2','$time3','$time4','$time5','$time6','$time7','$time8','$time9','$time10','$time11','$time12')");
?>
<html>
<head>
<title>Adding Schedule</title>
</head>
<body>
<form action="add_sch.php">
9:00AM <input required="required" type="text" name="time1" placeholder="Did you woke up?"/><br /><br />
10:00AM <input type="text" required="required" name="time2" placeholder="Did you breakfast"/><br /><br />
11:00AM <input type="text" required="required" name="time3" placeholder="Did you get out of house"/><br /><br />
1:00PM <input type="text" required="required" name="time4" placeholder="Did you pray Duhr"/><br /><br />
2:00PM <input type="text" name="time5" required="required" placeholder="Did you study"/><br /><br />
3:00PM <input type="text" name="time6" required="required" placeholder="Did you study"/><br /><br />
4:00PM <input type="text" name="time7" required="required" placeholder="Did you do setting"/><br /><br />
5:00PM <input type="text" name="time8" required="required" placeholder="Did you use computer"/><br /><br />
6:00PM <input type="text" name="time9" required="required" placeholder="Did you Asr"/><br /><br />
7:00PM <input type="text" name="time10" required="required" placeholder="Did you play out"/><br /><br />
8:00PM <input type="text" name="time11" required="required" placeholder="Did you pray Magrib"/><br /><br />
9:00PM <input type="text" name="time12" required="required" placeholder="Isha and Bed?"/><br /><br />
Comment:<br /><textarea name="comment" placeholder="What does everyone else say about your day?"></textarea><br /><br />
<input type="submit" value="Submit Schedule" />
</form>
</body>
</html>