[SOLUCIONADO] ¿Hacer que el formulario envíe el action a la misma página en php?

Iniciado por magodiesan, Abril 01, 2018, 12:52:10 AM

Tema anterior - Siguiente tema

0 Miembros y 1 Visitante están viendo este tema.

Resulta que tengo este formulario:

Código: php
  <form action="index.php" method="post"  enctype="multipart/form-data">
        <div class="form">
          <h3 class="row justify-content-center mt-5">Seleccione el tiempo en minutos que estará su imagen en línea</h3>
          <div class="row justify-content-center mt-1">
            <div class="btn-group" role="group">
              <button type="button" class="btn btn-warning">1</button>
              <button type="button" class="btn btn-warning">5</button>
              <button type="button" class="btn btn-warning">15</button>
              <button type="button" class="btn btn-warning">30</button>
              <button type="button" class="btn btn-warning">60</button>
            </div>
          </div>
          <div class="row justify-content-center mt-5">
            <input type="file" name="imagen" id="imagen" class="input-file">
            <label for="imagen" class="btn btn-lg btn-outline-black js-labelFile">
              <i class="icon fa fa-check"></i>
              <span class="js-fileName">Elija la imagen a subir</span>
            </label>
            <input type="submit" class="btn btn-lg btn-red" value="Subir Imagen">
          </div>
        </div>
      </form>


You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login

You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login
You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login

Hola @You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login, la próxima vez, por favor elabora más el post... Un simple enlace no es manera de crearlo.

Para hacer que el action lleve a la misma página sobrará con utilizar $_SERVER['PHP_SELF'];

Luego puedes controlar la recogida de datos con isset.

Un saludo.