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

80
Vistas
Updating Cookie from Form Post

FileOne.php is housing a <form> posting to FileTwo.php, which has roughly a 20s loading time.

FileOne.php is setting a cookie, setCookie('currentStep', 0), and I need FileTwo.php to update the cookie every time its own function updateStep() is called. The function and cookie are executing and updating correctly, but even if call the function immediately after the initial <?php at the top of my file, it still takes the full 20s for my cookie to update in the client.

FileTwo.php - Function

function updateStep() {
  setcookie("currentStep", ++$_COOKIE['currentStep']);
}

I've tried using ob_start() and ob_flush() to force a JavaScript cookie update to the client, but it's also taking the full 20s.

FileTwo.php - Alternative Attempt

<?php
  ob_start();
  echo "<script>document.cookie = 'currentStep=" . ++$_COOKIE['currentStep']) . "'<script>";
  ob_flush();

What I'm attempting to do is dynamically update a progress bar using the cookie as a marker for steps. I did find potential alternatives, but I'd still like to know if there's a way to update my cookie from FileTwo.php while it's being executed from the <form> post.

about 4 years ago · Juan Pablo Isaza
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