<?php
date_default_timezone_set("Europe/Athens");
?>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<script src="https://code.jquery.com/jquery-1.10.2.js"></script>
<script type="text/javascript">

function addRow(tableID) 
		{

			var table = document.getElementById(tableID);
			var rowCount = table.rows.length;
			var row = table.insertRow(rowCount);
			var rc=rowCount-1;
			var colCount = table.rows[rowCount-1].cells.length;

			for(var i=0; i<colCount; i++) 
			{

				var newcell	= row.insertCell(i);

				newcell.innerHTML = table.rows[rc].cells[i].innerHTML;
				//alert(newcell.childNodes);
				switch(newcell.childNodes[0].type) 
				{
					case "text":
							newcell.childNodes[0].value = "";
							break;
					case "checkbox":
							newcell.childNodes[0].checked = false;
							break;
					case "select-one":
							newcell.childNodes[0].selectedIndex = 0;
							break;
				}
			}
			
		}


function popupCenter(pageURL, title, w, h) 
{
    var left = (screen.width / 2)  - (w / 2);
    var top  = (screen.height / 2) - (h / 2);
    var targetWin = window.open(pageURL, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=1000, height=700, top='+top+', left='+left);
}

</script>
<style type="text/css">
table.myTable { border-collapse:collapse; }
table.myTable td, table.myTable th { border:1px solid green;padding:1px;font-size:10pt; }
<p style="font-size:10px;"></p>
input:focus, textarea:focus, select:focus{
        outline: none;}
</style>

</head>
<body>
<p>
<INPUT type="button" value="Προσθήκη Γραμμής" onclick="addRow('dataTable')" />
<TABLE id="dataTable" style='width:1000px' class='myTable'>
<thead style='border:1px solid black' bgcolor='#66CC99' >
<th>Α/Α</th>
<th>ΘΕΜΑ</th>
<th>ΛΕΠΤΟΜΕΡΕΙΕΣ</th>
</thead>
<tbody >
<?php
if ($c > 0)
{
	$i=1;
	while($i<=$k)
	 {
		 ?>
		 <tr>
		 <td> <?php
		 echo "<tr>";
		 echo "<td>".$i."</td>";
		 echo "<td>".'<textarea rows="5" cols="30" name="thema[]">'.$thema[$i].'</textarea>'."</td>";
		 echo "<td>".'<textarea rows="5" cols="110" name="perig[]">'.$lepto[$i].'</textarea>'."</td>";
		 echo "</tr>";
		 $i++;
	 }
		//mysqli_query($con,"delete from sintonismos where code='$code'");
}
else
{
$i=1;
while($i<=5)
 {
	 ?>
	 <tr>
	 <td> <?php
	 echo "<tr>";
	 echo "<td>".$i."</td>";
     echo "<td>".'<textarea rows="5" cols="30" name="thema[]" > </textarea>'."</td>";
	 echo "<td>".'<textarea rows="5" cols="110" name="perig[]" > </textarea>'."</td>";
	 echo "</tr>";
     $i++;
 }
}
echo "</tbody>";
echo "</table>";
?>
</p>