<?php require_once('Connections/cnxTestDate1.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }
  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "ajout-vacations")) {
  $insertSQL = sprintf("INSERT INTO vacation (num_vacation, nom_vac, num_iade, num_bloc, dat) VALUES (%s, %s, %s, %s, %s)",
                       GetSQLValueString($_POST['numero_vac'], "int"),
                       GetSQLValueString($_POST['libelle_vac'], "text"),
                       GetSQLValueString($_POST['num_iade'], "int"),
                       GetSQLValueString($_POST['num_bloc'], "int"),
                       GetSQLValueString($_POST['dat'], "date"));
  mysql_select_db($database_cnxTestDate1, $cnxTestDate1);
  $Result1 = mysql_query($insertSQL, $cnxTestDate1) or die(mysql_error());
}
mysql_select_db($database_cnxTestDate1, $cnxTestDate1);
$query_rsIade = "SELECT * FROM iade";
$rsIade = mysql_query($query_rsIade, $cnxTestDate1) or die(mysql_error());
$row_rsIade = mysql_fetch_assoc($rsIade);
$totalRows_rsIade = mysql_num_rows($rsIade);
mysql_select_db($database_cnxTestDate1, $cnxTestDate1);
$query_rsbloc = "SELECT * FROM bloc";
$rsbloc = mysql_query($query_rsbloc, $cnxTestDate1) or die(mysql_error());
$row_rsbloc = mysql_fetch_assoc($rsbloc);
$totalRows_rsbloc = mysql_num_rows($rsbloc);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Document sans titre</title>
<link type="text/css" href="css/style.css" rel="stylesheet" />
<link type="text/css" href="css/cupertino/jquery-ui-1.8.16.custom.css" rel="stylesheet" />
<script type="text/javascript" src="js/jquery-1.6.2.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.8.16.custom.min.js"></script>
<script type="text/javascript" src="js/ui.datepicker-fr.js"></script>
<script type="text/javascript">
$(document).ready(function() {
    $("#datepicker").datepicker();
});		
</script>  
<style type="text/css">
#ui-datepicker-div{ font-size: 80%; }
</style>
</head>
<body>
<p> </p>
<form id="ajout-vacations" name="ajout-vacations" method="POST" action="<?php echo $editFormAction; ?>">
  <p>
    <label for="numero_vac">Numero vacation :</label>
    <input type="text" name="numero_vac" id="numero_vac" accesskey="n" tabindex="1" />
  </p>
  <p>
    <label for="libelle_vac">Nom vacation :</label>
    <input type="text" name="libelle_vac" id="libelle_vac" accesskey="l" tabindex="2" />
  </p>
  <p>
    <label for="num_iade">Numero IADE :</label>
    <select name="num_iade" id="num_iade" accesskey="i" tabindex="3">
      <?php
do {  
?>
      <option value="<?php echo $row_rsIade['num_iade']?>"><?php echo $row_rsIade['num_iade']?></option>
      <?php
} while ($row_rsIade = mysql_fetch_assoc($rsIade));
  $rows = mysql_num_rows($rsIade);
  if($rows > 0) {
      mysql_data_seek($rsIade, 0);
	  $row_rsIade = mysql_fetch_assoc($rsIade);
  }
?>
    </select>
  </p>
  <p>
    <label for="num_bloc">Numero Bloc :</label>
    <select name="num_bloc" id="num_bloc" accesskey="b" tabindex="4">
      <?php
do {  
?>
      <option value="<?php echo $row_rsbloc['num_bloc']?>"><?php echo $row_rsbloc['num_bloc']?></option>
      <?php
} while ($row_rsbloc = mysql_fetch_assoc($rsbloc));
  $rows = mysql_num_rows($rsbloc);
  if($rows > 0) {
      mysql_data_seek($rsbloc, 0);
	  $row_rsbloc = mysql_fetch_assoc($rsbloc);
  }
?>
    </select>
  </p>
  <p>
    <label for="dat">Date :</label>
   
    <input type="text" id="datepicker" name="datepicker" />
  </p>
  <p> </p>
  <p>
    <input type="submit" name="envoi" id="envoi" value="Ajout d'une vacation" accesskey="e" tabindex="6" />
  </p>
  <p> </p>
  <input type="hidden" name="MM_insert" value="ajout-vacations" />
</form>
<p> </p>
</body>
</html>
<?php
mysql_free_result($rsIade);
mysql_free_result($rsbloc);
?>
			
		
 
	
Partager