<?php session_start();
error_reporting(0); 
 



include("../../config/connection.php");

include("../../config/function.php");

if(!isset($_REQUEST['opt'])){ ?>

<!DOCTYPE html>
<html lang="en">
<head>
  <title>Bootstrap Example</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
  <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
</head>
<body>




<form name="form1" method="post" action="index.php?page=AddActivityAction">
<input type="hidden" name="PAID" value="<?php  echo($_REQUEST['PAID']); ?>">
<input type="hidden" name="PID" value="<?php  echo($_REQUEST['PID']); ?>">
<input   type="hidden" name="opt" value="1">
<table width="500" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td>Date </td>
    <td><input type="date" name="datevisit" id="datevisit"></td>
  </tr>
  <tr>
    <td>City</td>
    <td><select name="city">
    <option value="0">please choose city</option>
    <?php $q="select * from city ";
	$re=mysqli_query($conn,$q);
	while($r=mysqli_fetch_array($re)){
		?>
        
        <option value="<?php echo($r['city_id']); ?>"><?php echo($r['city_name_en']); ?></option>
        <?php  
		
		}
	
	
	 ?>
    </select></td>
  </tr>
  <tr>
    <td>Town</td>
    <td><input type="text" name="twon" id="twon"></td>
  </tr>
  <tr>
    <td>Text</td>
    <td><textarea name="notes" id="notes" cols="45" rows="5"></textarea></td>
  </tr>
    <tr>
    <td>Hours</td>
    <td><input type="number" name="hours" id="hours" min="0"></td>
  </tr>

  <tr>
    <td>&nbsp;</td>
    <td><input type="submit" name="button" id="button" value="Submit"></td>
  </tr>
</table>

</form>
<?php
}
  if($_REQUEST['opt']==1){
	 
	 
	 
	 $insertActions=mysqli_query($conn,"insert into activity_action set 
 activity_action_date='".$_REQUEST['datevisit']."', 
 activity_action_subdate=now(),
  activity_action_userradd='".$_SESSION['admin_id']."', 
  activity_action_city='".$_REQUEST['city']."',  
  activity_action_town='".$_REQUEST['twon']."',  
  activity_action_desc='".$_REQUEST['notes']."',  
  activity_action_hours='".$_REQUEST['hours']."',  
  activity_action_benifiters='2',  
  activity_action_PAID='".$_REQUEST['PAID']."'
 ");
	
	
	// header("location:index.php?page=actionVol&PID=".$_REQUEST['PID']);
	 go('index.php?page=actionVol&PID='.$_REQUEST['PID'].'');
	
	} ?>
</body>
</html>