I always get this 000 0000-00-00 00:00:000 format
but not this 000|0000-00-00 00:00:00|0 format
For example I type 100 2000-10-02 06:00:10 6 in the three textboxes,
100 -> textbox 1
2000-10-02 06:00:10 -> textbox 2
6 -> textbox 3
it still remain the same 000 0000-00-00 00:00:000.
I want to get this data 100|2000-10-02 06:00:10|6 in sql database.
Please help me to solve.
textbox codes found in insert.php
<!--one textbox submit-->
<!--<tr>-->
<!--<td>Schedule Time</td>-->
<!--<td>:</td>-->
<!--<td><input name="schedule_time" type="text" id="schedule_time"></td>-->
<!--</tr>-->
<!--three textboxes submission of schedule_time 000|0000-00-00 00:00:00|0 -->
<td>Schedule Time</td>
<td>:</td>
<td>
<input type="text" name="schedule_time" id="schedule_time" value="<?php echo $ary[0]; ?>"> <!--000-->
<input type="text" name="schedule_time" id="schedule_time" value="<?php echo $ary[1]; ?>"> <!--0000-00-00 00:00:00-->
<input type="text" name="schedule_time" id="schedule_time" value="<?php echo $ary[2]; ?>"> <!--0-->
</td>
</tr>
insert_ac.php
// Get values from form
$name=$_POST['name'];
$lastname=$_POST['lastname'];
$email=$_POST['email'];
$schedule_time = $_POST['schedule_time'];
$val = "000|0000-00-00 00:00:00|0";
$ary = explode("|", $val);
$a = $ary[0];
$b = $ary[1];
$c = $ary[2];
$abc = $a . " " . $b . $c;
// Insert data into mysql
$sql="INSERT INTO $tbl_name(name, lastname, email, schedule_time)VALUES('$name', '$lastname', '$email', '$abc')";
$result=mysql_query($sql);
// if successfully insert data into database, displays message "Successful".
if($result){
echo "Successful";
echo "<BR>";
echo "<a href='insert.php'>Back to main page</a>";
}
else {
echo "ERROR";
}
// close connection
mysql_close();
?>
database file for import
--
-- Database: `1`
--
-- --------------------------------------------------------
--
-- Table structure for table `test_mysql`
--
CREATE TABLE IF NOT EXISTS `test_mysql` (
`id` int(4) NOT NULL AUTO_INCREMENT,
`name` varchar(65) NOT NULL DEFAULT '',
`lastname` varchar(65) NOT NULL DEFAULT '',
`email` varchar(65) NOT NULL DEFAULT '',
`schedule_time` varchar(25) CHARACTER SET utf8 NOT NULL DEFAULT '000|0000-00-00 00:00:00|0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ;
--
-- Dumping data for table `test_mysql`
--
INSERT INTO `test_mysql` (`id`, `name`, `lastname`, `email`, `schedule_time`) VALUES
(1, 'john', 'lere', 'yhh@hotmail.com', '000|0000-00-00 00:00:00|0'),