Hey,

I'm trying to automate copy and paste SQL inserts, but when I use POST the second array doesn't work. But it does if I set $dates manually... Any suggestions??

<?php 

if(isset($_POST['submit'])){

$GMT_times = array('GMT','CET');	
$ROW_times = array('AEDT','EDT','EET','GST','NZST','SGT');	

//$dates = $_POST['datesGMT'];

$dates="2015-07-01
2015-07-05
2015-07-08
2015-07-10
2015-07-12";

$GMTdates1 = explode("\n", $dates);
$ROWdates1 = explode("\n", $dates);

$gmtDates=array();
$rowDates=array();

foreach($GMTdates1 as $gmtDate){
$gmtDates[] = date('l M d, Y', strtotime($gmtDate));	
$rowDates[] = date('l M d, Y', strtotime($gmtDate. '+ 1 days'));	
}

$gmtDates2=implode("<br>", $gmtDates);
$rowDates2=implode("<br>", $rowDates);


?>
GMT &amp; CMT
<textarea rows="30" style="width:100%;">
<?php	
	foreach($_POST['checkbox'] as $value){

	foreach($GMT_times as $timezone){

	echo "INSERT INTO tblcoursedate VALUES('$value','".$_POST['startdateGMT']."','".$timezone."','".$gmtDates2."','http://www.sie.com/video/".date('M',$_POST['startdateGMT'])."/".$value."')\n";
	}

foreach($ROW_times as $timezone2){

	echo "INSERT INTO tblcoursedate VALUES('$value','".date('Y-m-d',strtotime($_POST['startdateGMT']. '+ 1 day'))."','".$timezone2."','".$rowDates2."')\n";
	}


}
?>
</textarea>
    <?php
}
?>

    So have you checked the contents of the [font=monospace]$_POST[/font] array to see if it contains what you think it contains?

      Write a Reply...