rendered paste body$etos = $_POST['txtYear'];
$dash = strpos($etos, "-"); // this looks for the dash (-) in the $years variable
if($dash !== false){
$start = substr($etos, 0, $dash);
$end = substr($etos, $dash + 1);
$array = range($start, $end);
$sql = "select * from tbl_year";
$result = mysql_query($sql);
while($row = mysql_fetch_assoc($result)){
extract($row);
if(in_array($year_name, $array)){
$year_table[] = $year_id;
}
}
print_r($year_table);
for($i=0; $i<sizeof($year_table); $i++){
echo $year_table[$i];
$sql = "insert into tbl_year_product set pd_id = '$pd_id2', year_id = '$year_table[$i]'";
mysql_query($sql);
}
}