Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

111
Vistas
Is there a way to take a variable from JS to PHP?

I'm wondering if there's a way to bring a variable from JS to PHP. I've got creating the variable in JS, I just wanna know if there's a way to bring it to PHP. HTML:

<form id="form" onsubmit="return false;">
    <input class="mainwrite" id="userInput">
    <input type="submit" onclick="save()">
</form>

JS:

function save() {
    var input = document.getElementById("userInput").value;
    alert(input);
}

I want to take the input variable and add it to a PHP file as a string.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Try this:

<script>
var var= "big boss";
</script>

<?php
echo "<script>document.writeln(var);</script>";
?>
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda