Location: PHPKode > projects > paperasse > paperasse/ajouter_papier.php
<?php
# ---------------------------------------
# Paperasse (c) 2006 Guillaume BETTAYEB
# mail and documents management web page
# hide@address.com
# ---------------------------------------
include_once('paperasse.conf.php');
include_once('MenuSelection.fc.php');

if(isset($HTTP_GET_VARS['id'])){
	
	$sql 	= 'SELECT * FROM `papiers` WHERE `id`='.$HTTP_GET_VARS['id'].' ORDER BY `id';
	$query	= mysql_query($sql) OR die(mysql_error());
	$array 	= mysql_fetch_array($query);
	extract($array);
	$datefr = split('-',$date);

	$sql 	= "SELECT * FROM `dossiers` WHERE `id`=$dossier ORDER BY `id`";
	$query	= mysql_query($sql) OR die(mysql_error());
	$array 	= mysql_fetch_array($query);
	extract($array);
	$ListeSelectionDossiers.= "<option style=\"color: $couleur;\" selected value=\"$id\">Conserver le m&ecirc;me dossier : $nom</option>\n";

	$sql 	= "SELECT * FROM `utilisateurs` WHERE `id`=$utilisateur";
	$query	= mysql_query($sql) OR die(mysql_error());
	$array 	= mysql_fetch_array($query);
	extract($array);
	$ListeSelectionUtilisateurs.= "<option selected value=\"$id\">Conserver le m&ecirc;me utilisateur : $nom</option>\n";
	
	$sql 	= "SELECT * FROM `contacts` WHERE `id`=$contact";
	$query	= mysql_query($sql) OR die(mysql_error());
	$array 	= mysql_fetch_array($query);
	extract($array);
	$ListeSelectionContacts.= "<option selected value=\"$id\">Conserver le m&ecirc;me contact : $nom</option>\n";
	
	//On réaffecte l'id courant obtenu par la variable de formulaire de la page précédente
	$id	= '<input type="hidden" name="id" value="'.$HTTP_GET_VARS['id'].'">';
}
else{
	$id 	= false;
	$datefr = array(date('Y'),date('m'),date('d'));
}

$ListeSelectionDossiers.= ListeSelectionDossiers();
$ListeSelectionUtilisateurs.= ListeSelectionUtilisateurs();
$ListeSelectionContacts.= ListeSelectionContacts();
?>
<!-- Feuille de style-->
<form name="ajouter" method="post" action="index.php?page=ajouter_papier_resultat">
<input type="hidden" name="type" value="ajouter">
<?php echo $id; ?>
  <table width="70%" border="0" align="center" cellpadding="5" cellspacing="5" class="tableau">
    <tr> 
      <td colspan="3"><div align="center" class="texte">Ajouter un papier dans 
          la base de donn&eacute;es</div></td>
    </tr>
    <tr> 
      <td width="12%" valign="top" class="texte">modalit&eacute;</td>
      <td colspan="2"><select name="modalite" class="bouton" id="modalite">
          <option value="entrant" selected>entrant</option>
          <option value="sortant">sortant</option>
        </select></td>
    </tr>
    <tr> 
      <td valign="top" class="texte">dates</td>
      <td width="24%"><span class="texte">date d'insertion</span> <span class="bouton"><?php echo date('d/m/y');?> 
        <input name="date" type="hidden" id="date" value="<?php echo date('y-m-d');?>">
        </span></td>
      <td width="64%" nowrap><span class="texte">date figurant sur le papier</span> 
        <span class="bouton"> 
        <input name="dc1" type="text" class="bouton" id="dc1" value="<?php echo $datefr[2]; ?>" size="2" maxlength="2">
        </span><span class="texte"> /</span><span class="bouton"> 
        <input name="dc2" type="text" class="bouton" id="dc2" value="<?php echo $datefr[1]; ?>" size="2" maxlength="2">
        </span><span class="texte"> /</span><span class="bouton"> 
        <input name="dc3" type="text" class="bouton" id="dc3" value="<?php echo $datefr[0]; ?>" size="4" maxlength="4">
        </span> </td>
    </tr>
    <tr> 
      <td valign="top" class="texte">dossier</td>
      <td colspan="2"><select name="dossier" id="dossier" class="texte">
          <?php echo $ListeSelectionDossiers; ?> </select></td>
    </tr>
    <tr> 
      <td valign="top" class="texte">utilisateur</td>
      <td colspan="2"><select name="utilisateur" id="dossier" class="bouton">
          <?php echo $ListeSelectionUtilisateurs; ?> </select> </td>
    </tr>
    <tr> 
      <td valign="top" class="texte">contact</td>
      <td colspan="2"><select name="contact" id="contact" class="bouton">
          <?php echo $ListeSelectionContacts; ?> </select></td>
    </tr>
    <tr> 
      <td valign="top" class="texte">objet<br> </td>
      <td><textarea name="objet" cols="50" rows="3" class="bouton" id="objet"><?php echo $objet; ?></textarea></td>
      <td> 
        <div align="center"><?php if(isset($HTTP_GET_VARS['id'])){$type='papiers'; include('dispo_traitement.php');} ?></div></td>
    </tr>
    <tr> 
      <td colspan="3" class="texte"><input name="ajouter" type="submit" class="bouton" id="ajouter" value="Ajouter ce papier &agrave; la base de donn&eacute;es"></td>
    </tr>
  </table>
</form>
<div align="center" class="texte"> </div>
Return current item: paperasse