0

No puedo recoger mi variable $_GET correctamente.

Tengo un boton que a traves de javascript me redirige a una url

$(".btnSeeGlossary").click(function() {
    let idGlossary = $(this).attr("idGlossary");


    window.location = "glossary?id=" + idGlossary;


})

Una vez redirigido, digamos que la url quedo http://localhost/translateapp/glossary?id=6, estoy en el sitio maquetado, quiero obtener el id de la siguiente manera:

$value = $_GET["id"];
var_dump($value);

Var dump me retorna NULL =(

Si cambio por

$value = $_GET;
var_dump($value);

Value retorna "glossary"

Edit: Dejo el htaccess por si esto pueda estar afectando.

Options All -Indexes 

RewriteEngine On 

RewriteRule ^([-a-zA-Z0-9]+)$ index.php?route=$1

1 respuesta 1

0

Finalmente, era el htaccess. Si reescribo las url debo agregar la bandera [QSA]

RewriteRule ^([-a-zA-Z0-9]+)$ index.php?route=$1 [QSA] 

solucionó el problema.

Tu Respuesta

By clicking “Publica tu respuesta”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

¿No es la respuesta que buscas? Examina otras preguntas con la etiqueta o formula tu propia pregunta.