Remove Line Jump in a Textarea php mysql javascript

0

I have this problem, that when entering text with line break to the textarea of my field Description product remains the same as the following image.

Well, when I give it to record or save in this way with line break when showing in my datatable, it does not show it because it is in "json", what I need is that when entering the text, the text is placed in a straight line or no line break.

This is my code to save or insert:

if($datos["selActivarOferta"] == "oferta"){

    $datosProducto = array(
           "titulo"=>$datos["tituloProducto"],
           "idCategoria"=>$datos["categoria"],
           "idSubCategoria"=>$datos["subCategoria"],
           "tipo"=>$datos["tipo"],
           "detalles"=>$datos["detalles"],
           "multimedia"=>$datos["multimedia"],
           "ruta"=>$datos["rutaProducto"],
           "estado"=> 1,
           "titular"=> substr($datos["descripcionProducto"], 0, 225)."...",
           "descripcion"=> $datos["descripcionProducto"],
           "palabrasClaves"=> $datos["pClavesProducto"],
           "precio"=> $datos["precio"],
           "peso"=> $datos["peso"],
           "entrega"=> $datos["entrega"],  
           "imgPortada"=>substr($rutaPortada,3),
           "imgFotoPrincipal"=>substr($rutaFotoPrincipal,3),
           "oferta"=>1,
           "precioOferta"=>$datos["precioOferta"],
           "descuentoOferta"=>$datos["descuentoOferta"],
           "imgOferta"=>substr($rutaOferta,3),
           "finOferta"=>$datos["finOferta"]
       );


}else{

    $datosProducto = array(
           "titulo"=>$datos["tituloProducto"],
           "idCategoria"=>$datos["categoria"],
           "idSubCategoria"=>$datos["subCategoria"],
           "tipo"=>$datos["tipo"],
           "detalles"=>$datos["detalles"],
           "multimedia"=>$datos["multimedia"],
           "ruta"=>$datos["rutaProducto"],
           "estado"=> 1,
           "titular"=> substr($datos["descripcionProducto"], 0, 225)."...",
           "descripcion"=> $datos["descripcionProducto"],
           "palabrasClaves"=> $datos["pClavesProducto"],
           "precio"=> $datos["precio"],
           "peso"=> $datos["peso"],
           "entrega"=> $datos["entrega"],  
           "imgPortada"=>substr($rutaPortada,3),
           "imgFotoPrincipal"=>substr($rutaFotoPrincipal,3),
           "oferta"=>0,
           "precioOferta"=>0,
           "descuentoOferta"=>0,
           "imgOferta"=>"",
           "finOferta"=>""
       );

}

This is the Html code:

   <div class="form-group">

      <div class="input-group">

        <span class="input-group-addon"><i class="fa fa-pencil"></i></span>


      <textarea type="text" rows="3" class="form-control input-lg descripcionProducto" placeholder="Ingresar descripción producto"></textarea>

      </div>

    </div>

This is my Datatable for Json Data list:

$datosJson .='[

                "'.($i+1).'",
                "'.$productos[$i]["titulo"].'",
                "'.$categoria.'",
                "'.$subcategoria.'",
                "'.$productos[$i]["ruta"].'",
                "'.$estado.'",
                "'.$productos[$i]["tipo"].'",
                "'.$cabeceras["descripcion"].'",
                "'.$cabeceras["palabrasClaves"].'",
                "'.$imagenPortada.'",
                "'.$imagenPrincipal.'",
                "'.$vistaMultimedia.'",
                "'.$vistaDetalles.'",
                "'.$precio.'",
                "'.$productos[$i]["peso"].' kg",
                "'.$entrega.'",
                "'.$tipoOferta.'",
                "'.$valorOferta.'",
                "'.$imgOferta.'",
                "'.$productos[$i]["finOferta"].'",          
                "'.$acciones.'"    

        ],';

Thank you ...

    
asked by AllegroCantabile 19.07.2018 в 08:59
source

1 answer

0

Remove the html tags from the text with strip_tags .

<textarea type="text" rows="3" class="form-control input-lg descripcionProducto" placeholder="Ingresar descripción producto"><?php echo strip_tags($mi_descripcion);?></textarea>
    
answered by 19.07.2018 в 09:06