Long variables by URL

0

I am creating a website of readings but it happens that when sending by the URL the content of a TextArea is very long and it returns an error 414 the browser, I am using PHP with AJAX

This is the TextArea field:

   <textarea id="I_Contenido" class="materialize-textarea"></textarea>

In the Javascript I recover it:

var Contenido =document.getElementById("I_Contenido").value;

Send it to the php in this way:

  xmlhttp.open("POST","../Entities/addLectura.php?Titulo="+Titulo+"&Descripcion="+Descripcion+"&Autor="+Autor+"&Imagen="+Imagen+"&Fecha="+Fecha+"&Contenido="+Contenido,true);

And in PHP I recover it like this:

$Contenido = ($_GET['Contenido']);

Any idea how I could compress the text or have it allow me to send it?

    
asked by Alejandro Melendez 13.11.2017 в 04:42
source

3 answers

1

I am corrected, what I did is use a form and send it by POST to the PHP file where I insert it into the database, just as the base change the field by longtext

    
answered by 13.11.2017 в 05:12
1

Indeed, the best option, in addition to being transparent for the user, is always to try to use methods sending by POST, if we have to send many parameters, the ideal is to mount an array and even work with JSON, easy to use with JS and with PHP.

    
answered by 13.11.2017 в 09:19
0

Under Apache, the limit is a configurable value in the limitrequestLine value in the file /etc/apache2/apache2.conf.

However, on many occasions we do not have the possibility to alter this value, either because our system is in a shared domain, our administrator does not authorize us ... or other causes, it is a good idea Jorge Peinado's proposal and try to send it for $ _POST

I hope I could help. Greetings

    
answered by 13.11.2017 в 18:36