dodomomo:
S’il vous plait est qu’il ya quelqu’un qui peut m’aider ?
J’ai fait ce code mais j’ais un problème au niveau de l’enregistre dans la base où aucune information ne sera enregistre dans la base.
S’il vous plait aider-moi.
Voila les pages de mon code :
Page AjoutAjout.php
<body background="backblue.gif">
<form name="forme" method="POST" action="AjoutRessource1.php" enctype="multipart/form-data">
<p align="center"> </p>
<p align="center"><font color="#FF00CC" size="+3">Administration Documents à Télécharger </font><br>
<table>
</p>
<tr><td width="130"> <label style="margin-left:20px;"><strong><font color="#0033FF"> Code</font> </strong> </label> </td>
<td width="354"><input name="code" type="text" id="code" size="50"></td></tr>
<tr><td><label style="margin-left:20px;"><strong><font color="#0033FF">Titre</font></strong></label></td>
<td width="354"><input name="titre" type="text" id="titre" size="50"></td></tr>
<tr><td><label style="margin-left:20px;"><strong><font color="#0033FF">Auteur</font></strong></label></td>
<td width="354"><input name="auteur" type="text" id="auteur" size="50"></td></tr>
<tr><td><label style="margin-left:20px;"><strong><font color="#0033FF">Chemin</font></strong></label></td>
<td><input type="file" name="chemin" id="chemin"></td></tr>
<tr><td><label style="margin-left:20px;"><strong><font color="#0033FF">Type</font></strong></label></td>
<td width="354"><input name="type" type="text" id="type" size="50"></td></tr>
<tr><td></td><td align="center"><input type="submit" value="ajouter" class="filtre" rel="lightbox" /></td></tr>
</table>
</form>
<div align="center"><strong><a href="admin.php"><font color="#0099FF"><<<Retour</font></a></strong></div>
</body>
Page AjoutRessource1.php
<?php
require_once('connexxionBase.php');
mysql_select_db($bd);
if ( isset( $_POST ) )
$postArray = &$_POST ; // 4.1.0 or later, use $_POST
else
$postArray = &$HTTP_POST_VARS ; // prior to 4.1.0, use HTTP_POST_VARS
if ( get_magic_quotes_gpc() )
{
$code = htmlspecialchars( stripslashes( $_POST['code'] ) ) ;
$titre = htmlspecialchars( stripslashes( $_POST['titre'] ) ) ;
$auteur = htmlspecialchars( stripslashes( $_POST['auteur'] ) ) ;
$type = htmlspecialchars( stripslashes( $_POST['type'] ) ) ;
}
else
{
$code = $_POST['code'];
$titre = $_POST['titre'];
$auteur = $_POST['auteur'];
$type = $_POST['type'];
}
if($code!="" && $titre!="" && $auteur!="" && $type!="")
{
$file_ext = strrchr($_FILES['chemin']['name'], '.');
$newname = time().rand(0,100000).$file_ext;
$chemin_u = "document/";
$file_u=$chemin_u.$newname;
move_uploaded_file($_FILES['chemin']['tmp_name'],$file_u) or die('erreur upload');
$query="insert into ressource(id, code, titre, auteur, chemin, type) values ('' ,'$code','$titre','$auteur','$newname','$type')";
mysql_query($query);
echo '<script language="javascript">window.location.replace("modif1Doc.php");</script>';
}
else
{
echo '<script language="javascript">alert("erreur");window.location.replace("ajoutajout.php");</script>';
}
?>
Page modif1Doc.php
<body background="backblue.gif">
<table width="70%" align="center" border="1" cellpadding="3" cellspacing="0" bordercolor="#FFFFFF">
<tr><td><a href="admin.pfp"><font color="#0033FF"><<<Retour</font></a></td>
</tr>
<tr align="center">
<td bgcolor="#53F7F9"><font color="#344D67" size="3">Code</font></td>
<td bgcolor="#53F7F9" ><font color="#344D67" size="3">Titre</font></td>
<td bgcolor="#53F7F9"><font color="#344D67" size="3">Auteur</font></td>
<td bgcolor="#53F7F9" ><font color="#344D67" size="3">Type</font></td>
</tr>
<?php
require_once('connexxionBase.php');
mysql_select_db($bd);
//$query="insert into ressource values ('' ,'$code','$titre','$auteur','$newname','$type')";
$req="select * from ressource order by id";
$res=mysql_query($req)or die("Erreur SQL : $query<br/>".mysql_error());
while($data=mysql_fetch_array($res))
{
echo'<tr align="center"><td>'.$data['code'].'</td><td>'.$data['titre'].'</td><td>'.$data['auteur'].'</td><td>'.$data['type'].'</td><td bgcolor="#CCFF66"><a href="document/'.$data['chemin'].'" target="_blanck">Télécharger</a></td><td bgcolor="#CCCCCC"><a href="modif2Doc.php?id='.$data['id'].'">modifier</a></td><td bgcolor="#CCCCCC"><a href="ConfirmSuppDoc.php?id='.$data['id'].'" title="Suppression Document!!">supprimer</a></td></tr>';
}
echo '</table>';
?>
</body>
voici mon table du base:
SELECT id, code, titre, auteur, chemin, type FROM `ressource` WHERE 1