How to upload a text from summernote to mysql

0

I have a text in javascript with the library summernote but I do not know how to upload it to mysql below is the code I have

<?php
	
	session_start();
	if (!isset($_SESSION['user_login_status']) AND $_SESSION['user_login_status']) 
    {
        header("location: login.php"); 
        exit;                                              
        }


	
	require_once ("config/db.php");
	require_once ("config/conexion.php");
		
	$active_ticket="active";	
	$title="Prestamos	| Simple Stock";
    $Nticket= $_GET['Nticket'];
    $incidencia= $_GET['incidencia'];
    $tema= $_GET['tema'];
    $detalle= $_GET['detalle'];
    $firstname= $_GET['firstname'];




     if(isset($_POST["respuesta"]))
               $respuesta = $_POST["respuesta"];
            else
                $respuesta =NULL;
                $sql = "SELECT * FROM ticket WHERE incidencia = '" . $incidencia . "' OR tema = '" . $tema . "';";
                $query_check_incidencia = mysqli_query($con,$sql);
				
                    $sql = "INSERT INTO ticket (respuesta) VALUE('".$respuesta."');";
           
                    $query_new_incidencia_insert = mysqli_query($con,$sql);





       ?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
                    <title>Summernote</title>
  <link href="http://netdna.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.css" rel="stylesheet">
  <script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.js"></script> 
  <script src="http://netdna.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.js"></script> 
  <link href="http://cdnjs.cloudflare.com/ajax/libs/summernote/0.8.8/summernote.css" rel="stylesheet">
  <script src="http://cdnjs.cloudflare.com/ajax/libs/summernote/0.8.8/summernote.js"></script>
</head>
<body>
   <?php include("head.php");
    include("navbarhelp.php");?>
    
    <div class="subject">Asunto:<strong><?php echo $tema; ?></strong></div>
    <div id="ticketThread">
    <table class="thread-entry message" cellspacing="0" cellpadding="1"width="800" boder="0">
        <tbody>
            <tr>
            <th>
            <div>
                <span class="textra"></span>
                <span><?php echo $firstname; ?></span>
                </div>    
            </th>
            </tr>
        <tr>
            <td class="thread-body"><div><?php echo $detalle ?></div></td>
            </tr>
        </tbody>
        </table>
        <table class="thread-entry response" cellspacing="0" cellpadding="1" width="800" border="0">
        <tbody>
            <tr>
            <th>
                <div>
                Respuesta <span class="textra"></span>
                <span></span>
                </div>
                </th>
            </tr>
            <tr><br>
                <td class="thread-body"><br><div><?php echo $respuesta?><br></div></td></tr>
            </tbody></table></div>
          
    <form action="respuestas.php?Nticket=<?php echo $Nticket?>&incidencia=<?
      =$incidencia?>&tema=<?=$tema?>&detalle=<?=$detalle?>&firstname=<?
     =$firstname?>" method="post"> 
    <div id="summernote"></div>
      
   <button type="submit" id="respuesta" name="submit" 
           value="1">Responder</button>
  </form>
  <script>
   $(document).ready(function() {
      $('#summernote').summernote();

    
  });
</script>
</body>
</html>
    
asked by Kevin Salazar 27.11.2017 в 16:01
source

1 answer

0

Send the content of summernote as it comes is not possible to take it to your controller, before sending you will have to work with the functions encode of javascript to be able to send them; and in the same way to load them.

//tomar el contenido
encodeURIComponent(summnernote.contenido);
//cargar el contenido
decodeURIComponent(mysql.contenido);

In short, you will save the encodeURI from your summernote.

    
answered by 06.02.2018 в 21:07