Location: PHPKode > projects > paperasse > paperasse/ajouter_contact.php
<?php
# ---------------------------------------
# Paperasse (c) 2006 Guillaume BETTAYEB
# mail and documents management web page
# hide@address.com
# ---------------------------------------
@include_once('paperasse.conf.php');
$nom	= false;
$num	= false;
$rue	= false;
$bp		= false;
$cdx	= false;
$cp		= false;
$ville	= false;

if(isset($HTTP_GET_VARS['id'])){
	$sql 	= 'SELECT * FROM `contacts` WHERE `id`='.$HTTP_GET_VARS['id'];
	$query	= mysql_query($sql) OR die(mysql_error($query));
	$array 	= mysql_fetch_array($query,MYSQL_ASSOC);
	extract($array);
	
	//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;
}
?>
<!-- Feuille de style-->
 
<form name="ajouter_contact" method="post" action="index.php?page=ajouter_contact_resultat">
<?php echo $id; ?>
  <table width="61%" border="0" align="center" cellpadding="2" cellspacing="2" class="tableau">
    <tr> 
      <td colspan="2" class="texte"><div align="center">AJOUTER UN CONTACT</div></td>
    </tr>
    <tr> 
      <td width="16%" class="texte"><div align="center">Nom </div></td>
      <td width="84%"><input name="nom" type="text" class="bouton" <?php echo "value=\"$nom\""; ?> size="80" maxlength="80"></td>
    </tr>
    <tr> 
      <td class="texte"><div align="center">Num&eacute;ro de rue </div></td>
      <td><input name="num" type="text" class="bouton" <?php echo "value=\"$num\""; ?> size="4" maxlength="4"></td>
    </tr>
    <tr> 
      <td class="texte"><div align="center">Rue du contact</div></td>
      <td><input name="rue" type="text" class="bouton" <?php echo "value=\"$rue\""; ?> size="80" maxlength="255"></td>
    </tr>
    <tr> 
      <td class="texte"><div align="center">Bo&icirc;te postale</div></td>
      <td><input name="bp" type="text" class="bouton" <?php echo "value=\"$bp\""; ?> size="4" maxlength="4"></td>
    </tr>
    <tr> 
      <td class="texte"><div align="center">Cedex</div></td>
      <td><input name="cdx" type="text" class="bouton" <?php echo "value=\"$cdx\""; ?> size="3" maxlength="3"></td>
    </tr>
    <tr> 
      <td class="texte"><div align="center">Code postal</div></td>
      <td><input name="cp" type="text" class="bouton" <?php echo "value=\"$cp\""; ?> size="5" maxlength="5"></td>
    </tr>
    <tr> 
      <td class="texte"><div align="center">ville</div></td>
      <td><input name="ville" type="text" class="bouton" <?php echo "value=\"$ville\""; ?> size="50" maxlength="50"></td>
    </tr>
    <tr> 
      <td colspan="2"><input name="Submit" type="submit" class="bouton" value="Ajouter ce nouveau contact"></td>
    </tr>
  </table>
</form>
Return current item: paperasse