<?php
session_start();
ob_start();
?><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script type="text/javascript">
 
$(document).ready(function(){

    $("#addSchool").click(function(){
    $("#schoolContainer").append('<option value="' + $("#newSchool").val() + '">' + $("#newSchool").val() + '</option>');
    });
 
</script>
<style type="text/css">
table.myTable { border-collapse:collapse; }
table.myTable td, table.myTable th { border:1px solid black;padding:2px;font-size:11px; }

.fieldset1
{
    width:770px;
	background: #F5F9F0;
	border:2px solid green;
    -moz-border-radius:4px;
    -webkit-border-radius:4px;	
    border-radius:4px;	
}

.label1
{
display:inline-block;
width:120px;
margin-right:10px;
text-align:right;
}
.label2
{
display:inline-block;
width:200px;
margin-right:10px;
text-align:right;
}
</style>

<h3> ΚΑΤΑΓΡΑΦΗ ΗΛΕΚΤΡΟΝΙΚΟΥ ΕΞΟΠΛΙΣΜΟΥ </h2>
<?php
require "dbconnect.php";
/*
?>
<form method='post' action=>
    
    <label>ΕΠΕΛΕΞΕ ΥΠΗΡΕΣΙΑ:</label>
    <select name="loc" >
    <?php
    echo "<option value='1'>1. ΕΠΑΡΧΙΑΚΟ ΓΡΑΦΕΙΟ ΛΕΥΚΩΣΙΑΣ</option>";
    echo "<option value='2'>2. ΓΡΑΦΕΙΟ ΑΓΙΟΥ ΑΝΔΡΕΑ</option>";
    echo "<option value='3'>3. ΑΝΕΡΓΕΙΑΚΟ ΓΡΑΦΕΙΟ</option>";
    ?>
	
    </select>
<input type="submit" value="ΕΠΙΛΟΓΗ" name="submit1">	
</form>
<?php
if (isset($_POST['submit1'])) 
{
	$office=$_POST['loc'];
	

$office=$row['office'];
$user=$row['user'];
$username=$row['username'];
$snpc=$row['snpc'];
$ippc=$row['ippc'];
$modelpc=$row['modelpc'];
$snprint=$row['snprinter'];
$ipprint=$row['ipprint'];
$printname=$row['printname'];
$printmodel=$row['printmodel'];
$snpos=$row['snpos'];
$snscreen=$row['snscreen'];
$modelscreen=$row['modelscreen'];*/
$office=1;
$user=" ";
$username=" ";
$snpc=" ";
$ippc=" ";
$modelpc=" ";
$snprint=" ";
$ipprint=" ";
$printname=" ";
$printmodel=" ";
$snpos=" ";
$snscreen=" ";
$modelscreen=" ";
?>
<form method='post' >
<br><br>
<fieldset fieldset class="fieldset1"  >
<legend> <?php echo "<b>"." ΣΤΟΙΧΕΙΑ ΧΡΗΣΤΗ "."</b>"; ?> </legend>
User:</label><input type='text' size='30' name= "user" value = "<?php echo $user; ?>" /><?php echo str_repeat("&nbsp",8);?>
User Name:<input type='text' size='20' name="username" value = "<?php echo $username; ?>" />
<?php echo str_repeat("&nbsp",8);?>Location:<input type='text' size='2' name="office" value = "<?php echo $office; ?>" />
</p>
</fieldset><br>
<fieldset fieldset class="fieldset1"  >
<legend> <?php echo "<b>"." ΣΤΟΙΧΕΙΑ ΕΞΟΠΛΙΣΜΟΥ "."</b>"; ?> </legend>
<br>
<label class="label1" >S/N PC:</label><input type='text' name='snpc' size='20' value = "<?php echo $snpc; ?>" />
<label class="label1" >I/P PC:</label><input type='text' name='ippc' size='20' value = "<?php echo $ippc; ?>" /></p>
<label class="label1" >PC NAME:</label><input type='text' name='pcname' size='20' value = "<?php echo $pcname; ?>" /> 
<label class="label1" >PC MODEL:</label><input type='text' name='modelpc' size='20' value = "<?php echo $modelpc; ?>" /> 
</p><br>
<label class="label1" >S/N PRINTER:</label><input type='text' name='snprint' size='20' value = "<?php echo $snprint; ?>" />
<label class="label1" >I/P PRINTER:</label><input type='text' name='ipprint' size='20' value = "<?php echo $ipprint; ?>" /></p>
<label class="label1" >PRINTER NAME:</label><input type='text' name='nameprint' size='20' value = "<?php echo $nameprint; ?>" /> 
<label class="label1" >PRINTER MODEL:</label><input type='text' name='modelprint' size='20' value = "<?php echo $modelprint; ?>" />
</p><br>
<label class="label1" >S/N POS:</label><input type='text' name='snpos' size='20' value = "<?php echo $snpos; ?>" /></p>
<label class="label1" >S/N SCREEN:</label><input type='text' name='snscreen' size='20' value = "<?php echo $snscreen; ?>" />
<label class="label1" >SCREEN MODEL:</label><input type='text' name='modelscreen' size='20' value = "<?php echo $modelscreen; ?>" /> </p>
<p>
<select name="school" id="schoolContainer">
    <option value="None" selected>None</option>
    <option value="DeSoto">DeSoto</option>
    <option value="Hillsboro">Hillsboro</option>
    <option value="Grandview">Grandview</option>
    <option value="Festus">Festus</option>
    <option value="R-7">R-7</option>
    <option value="Home-Schooled">Home-Schooled</option>
</select>
  <input type="text" id="newSchool"/>
    <input type="button" id="addSchool" value="Insert"/>
</fieldset>

<input type="submit" value="ΚΑΤΑΧΩΡΗΣΗ" name="submit">
</form>
	
<?php
if (isset($_POST['submit'])) 
{
	echo "xxxxxxxxxxx";
$office=$_POST['office'];
$user=$_POST['user'];
$username=$_POST['username'];
$snpc=$_POST['snpc'];
$ippc=$_POST['ippc'];
$modelpc=$_POST['modelpc'];
$snprint=$_POST['snprint'];
$ipprint=$_POST['ipprint'];
$nameprint=$_POST['nameprint'];
$modelprint=$_POST['modelprint'];
$snpos=$_POST['snpos'];
$snscreen=$_POST['snscreen'];
$modelscreen=$_POST['modelscreen'];        
$sql = $dbcon->prepare("insert into items (office,user,username,snpc,ippc,modelpc,snprint,ipprint,
       nameprint,modelprint,snpos,snscreen,modelscreen) values (?,?,?,?,?,?,?,?,?,?,?,?,?)");
$sql->execute([$office,$user,$username,$snpc,$ippc,$modelpc,$snprint,$ipprint,$nameprint,$modelprint,$snpos,$snscreen,$modelscreen]);	
}

?>
<br /><br />
<a  href=<?php echo $menu;?> style="color:blue "  > <button> Επιστροφή στο Μενού  </a>

</body>
</html>