Buonasera a tutti,
vi spiego il problema:
ho una pagina PHP (vedi in fondo al post) da cui mando dei contenuti da salvare su DB (data.php).
Se NON impiego CKEditor, quindi con una semplice textarea, i dati vengono correttamente salvati sul DB mentre se impiego CKEditor non mi salva alcun dato.
Il campo del db MYSQL è un campo testo, senza limitazioni particolari, quindi non riesco a capire il problema...
avete dei suggerimenti ?
Grazie mille
PAGINA PHP
[PHP]<!DOCTYPE html><html lang="en"> <head> <meta charset="utf-8"> <title></title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="description" content=""> <meta name="author" content="">
<!-- Le styles --> <link href="assets/css/bootstrap.css" rel="stylesheet"> <style> body { padding-top: 30px; }a:hover{text-decoration:none;} </style> <!-- CKEDITOR --> <script src="ckeditor/ckeditor.js"></script>
<link href="assets/css/bootstrap-responsive.css" rel="stylesheet">
<!-- Fav and touch icons --> <link rel="shortcut icon" href="assets/ico/favicon.ico"> <link rel="apple-touch-icon-precomposed" sizes="144x144" href="assets/ico/apple-touch-icon-144-precomposed.png"> <link rel="apple-touch-icon-precomposed" sizes="114x114" href="assets/ico/apple-touch-icon-114-precomposed.png"> <link rel="apple-touch-icon-precomposed" sizes="72x72" href="assets/ico/apple-touch-icon-72-precomposed.png"> <link rel="apple-touch-icon-precomposed" href="assets/ico/apple-touch-icon-57-precomposed.png"> </head> <body> <div style="position:absolute; top:0; right:100px; background-color:#fff; box-shadow: 0 1px 5px rgba(0, 0, 0, 0.25); width:250px; height:50px;"> <div id="login_avatar" style="width:50px; height:50px; float:left; margin:0; background-image: url('<?php echo "gravatar.com/avatar/" . md5( strtolower( trim( $_SESSION['user_email'] ) ) ) . "?d=mm&s=50"; ?>')"> </div> <div style="width: 110px; height: 50px; float:left; margin:0; font-family: 'Droid Sans', sans-serif; color:#666666; font-size:12px; border:0; height:100%; line-height: 50px; padding-left:20px; padding-right: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;"> Ciao <?php echo $_SESSION['user_name']; ?> </div> <div class="login_logout"> <a href="admin.php?logout" style="width:49px; height:19px; padding-top: 31px; display:block; text-align: center; font-size:18px; color:#ff0000; border:0; background: transparent; cursor: pointer;" >Esci</a> </div> </div> <div class="container"> <div class="row"> <div class="span12"><br><br><br> <form id="myForm" action="config/data.php" method="post"> <input type="hidden" name="data" value="<?php echo date("Ymd"); ?>"/> <label>Titolo*:</label> <input type="text" name="titolo" class="input-block-level"/> <label>Testo*:</label> <textarea name="testo" id="testo" class="input-block-level" /></textarea> <br> <!-- CKEDITOR --> <script> CKEDITOR.replace( 'testo' ); </script>
<input type="submit" value="SALVA" class="btn btn-success btn-large" /> <br><br><br> <hr> <br><br><br> <label>Video Youtube</label> <input type="text" name="urlvideo" class="input-large search-query"/> <input type="submit" value="SALVA" class="btn btn-success btn-large" /> <br><br><br> <hr> <br><br><br> <label>Foto 1:</label> <input type="text" name="urlfoto1" class="input-medium search-query"/> <label>Foto 2:</label> <input type="text" name="urlfoto2" class="input-medium search-query"/> <label>Foto 3:</label> <input type="text" name="urlfoto3" class="input-medium search-query"/> <label>Foto 4:</label> <input type="text" name="urlfoto4" class="input-medium search-query"/> <label>Foto 5:</label> <input type="text" name="urlfoto5" class="input-medium search-query"/> <label>Foto 6:</label> <input type="text" name="urlfoto6" class="input-medium search-query"/><br> <input type="submit" value="SALVA" class="btn btn-success btn-large" /> </form> </div> <div id="showdata"> <?include("config/data.php");?> </div>
</div> </div> <!-- /container -->
<!-- Le javascript ================================================== --> <!-- Placed at the end of the document so the pages load faster --> <script src="views/js/jquery-1.8.1.min.js" type="text/javascript"></script> <script src="views/js/jquery.md5.min.js" type="text/javascript"></script> <script src="views/js/beautiful_login.js" type="text/javascript"></script> <script src="assets/js/jquery.js"></script> <script src="assets/js/bootstrap-transition.js"></script> <script src="assets/js/bootstrap-alert.js"></script> <script src="assets/js/bootstrap-modal.js"></script> <script src="assets/js/bootstrap-dropdown.js"></script> <script src="assets/js/bootstrap-scrollspy.js"></script> <script src="assets/js/bootstrap-tab.js"></script> <script src="assets/js/bootstrap-tooltip.js"></script> <script src="assets/js/bootstrap-popover.js"></script> <script src="assets/js/bootstrap-button.js"></script> <script src="assets/js/bootstrap-collapse.js"></script> <script src="assets/js/bootstrap-carousel.js"></script> <script src="assets/js/bootstrap-typeahead.js"></script>
<script type="text/javascript" src="assets/js/jquery.form.js"></script><script> $(".btn-success").click(function () { $(".span12").fadeOut("slow"); }); </script> <script type="text/javascript"> $(document).ready(function() { $('#myForm').ajaxForm({ target: '#showdata', success: function() { $('#showdata').fadeIn('slow'); } }); }); </script> </body></html>
[/PHP]
data.php
[PHP]<?//connect to database$dbhost = 'localhost';$dbuser = 'root';$dbpass = '';$dbname = 'login';
$conn = mysql_connect($dbhost, $dbuser, $dbpass);mysql_select_db($dbname);
//NOTE: MAKE SURE YOU DO YOUR OWN APPROPRIATE SERVERSIDE ERROR CHECKING HERE!!!if(!empty($_POST) && isset($_POST)){ //make variables safe to insert $data = mysql_real_escape_string($_POST['data']); $titolo = mysql_real_escape_string($_POST['titolo']); $testo = mysql_real_escape_string($_POST['testo']);
$urlvideo = mysql_real_escape_string($_POST['urlvideo']);
$urlfoto1 = mysql_real_escape_string($_POST['urlfoto1']); $urlfoto2 = mysql_real_escape_string($_POST['urlfoto2']); $urlfoto3 = mysql_real_escape_string($_POST['urlfoto3']); $urlfoto4 = mysql_real_escape_string($_POST['urlfoto4']); $urlfoto5 = mysql_real_escape_string($_POST['urlfoto5']); $urlfoto6 = mysql_real_escape_string($_POST['urlfoto6']);
//query to insert data into table $sql = " INSERT INTO dati SET data = '$data', titolo = '$titolo',
urlvideo = '$urlvideo',
urlfoto1 = '$urlfoto1', urlfoto2 = '$urlfoto2', urlfoto3 = '$urlfoto3', urlfoto4 = '$urlfoto4', urlfoto5 = '$urlfoto5', urlfoto6 = '$urlfoto6', testo = '$testo'"; $result = mysql_query($sql); if(!$result) { echo "Failed to insert record"; } else { echo " Pagina salvata ! <a href=\"index.php\">Vedi la pagina</a> <br> <a href=\"admin.php\">Visualizza tutte le pagine</a> "; }}?>[/PHP]