funux | - Avec un print_r($_POST) j'ai Array ( ) qui s'affiche.
- Tiens c'est vrai j'avais pas vu le input hidden entre les div, vais le virer merci
Code :
- <?
- session_start() ;
- require_once('../plugins/functions.php');
- require_once('../plugins/securite.php');
- require('parties.php');
- if ((securite($_GET['id_outils'],$_SESSION['login'])) == "acces_nok" )
- {
- echo "<html><head><META http-equiv=\"refresh\" content=\"1; URL=../index.php?message=droits\"></head><body></body></html>";
- }
- ?>
- <html>
- <head>
- <title>toto| Intranet</title>
- <link rel="shortcut icon" href="/favicon.ico" />
- <link rel="stylesheet" type="text/css" media="screen" href="../css/principal.css" />
- <style type="text/css">@import url(./calendar/skins/aqua/theme.css);</style>
- <script type="text/javascript" src="./calendar/calendar.js"></script>
- <script type="text/javascript" src="./calendar/lang/calendar-fr.js"></script>
- <script type="text/javascript" src="./calendar/calendar-setup.js"></script>
- </head>
- <? if (isset($_GET['type']) && ($_GET['type'] == "details_outil" )){echo "<body id=\"showroom\">";} else { echo "<body id=\"index\">";} ?>
- <div id="wrapper">
- <? entete(); //AFFICHE LES LIENS EN DEBUT DE PAGE ?>
- <div id="sidenotes">
- <div id="writecomment">
- <? if ((isset($_GET['message'])) && ($_GET['message'] =="creation_ok" )){ echo "<h1>News ajoutée</h1></br>";} ?>
- <h3>Création d'une nouvelle<span> News</span></h3>
- <p>Tout les champs sont obligatoires</p>
- <form method="POST" action="../includes/update_news.php" name="news">
- <input type="hidden" name="id_outils" value="<? echo $_GET['id_outils']; ?>" />
- <div>
- <input type="hidden" name="act" value="ajout_news" />
- </div>
- <p><label for="name">Titre de la news:</label>
- <input type="text" name="titre_news" id="name" size="50" /></p>
- <p><label for="name">Date:</label>
- <input name="date_news" value="<? echo date("d/m/Y" ); ?>" type="text" size="10" maxlength="10" id="date"></p>
- <script type="text/javascript">
- Calendar.setup({
- ifFormat : "%d/%m/%Y",
- showsTime : false,
- inputField : "date", // id of the input field
- step : 1
- });
- </script>
- <p><label for="name">Contenu de la news:</label>
- <textarea name="contenu" rows="20" cols="100"></textarea></p>
- <p><input type="submit" value="ajouter"></p>
- </form>
- </div>
- </div>
- <div id="sidenotes">
- <div class="writecomment">
- <h3>Création d'une <span>news</span></h3>
- </div>
- </div>
- <? //vie_pratique(); //AFFICHER LES LIENS VIE PRATIQUE?>
- <div id="copyright">
- <h4><strong>© 2007</strong> TOTO</h4>
- </div>
- </div>
- </body>
- </html>
|
update_news.php
Code :
- <?PHP
- session_start() ;
- require_once('../plugins/securite.php');
- require_once('../plugins/connexion.php');
- print_r($_POST);
- // ###############################FUNCTIONS
- function replace($string){
- $string = str_replace("~","",$string);
- $string = str_replace("#","",$string);
- $string = str_replace("{","",$string);
- $string = str_replace("`","",$string);
- $string = str_replace("^","",$string);
- $string = str_replace("°","",$string);
- $string = str_replace("}","",$string);
- $string = str_replace("¨","",$string);
- $string = str_replace("£","",$string);
- $string = str_replace("¤","",$string);
- $string = str_replace("µ","",$string);
- $string = str_replace("§","",$string);
- $string = str_replace("'","\'",$string);
- return $string;
- }
- function date_fr_to_us($datetime) {
- $a = substr($datetime, 6, 4); // conversion
- $m = substr($datetime, 3, 2); // de la date
- $j = substr($datetime, 0, 2); // au format
- $datetime = $a.'-'.$m.'-'.$j; // US
- return $datetime;
- }
- // ############################### SECURITE
- //if ((securite($_POST['id_outils'],$_SESSION['login'])) == "acces_nok" )
- //{
- //echo "<html><head><META http-equiv=\"refresh\" content=\"1; URL=../index.php?message=droits\"></head><body></body></html>";
- //}
- // ############################### PROGRAMME
- switch($_POST['act'])
- {
- case "ajout_news":
- //DECLARATIONS VARIABLES
- $titre_news = $_POST['titre_news'];
- $date_news = date_fr_to_us($_POST['date_news']);
- $contenu = replace($_POST['contenu']);
- mysql_select_db($database, $connect); //CONNEXION
- $sql = "insert into news (titre_news, date_news, contenu) values ('".$titre_news."', '".$date_news."', '".$contenu."')"; // INSERT
- mysql_query ($sql, $connect);
- mysql_close();
- header("Location:../pages/communication_creation_news.php?message=creation_ok&id_outils=".$_POST['id_outils']."" );
- break;
- }
- ?>
|
merci pour les reponses |