I have the following structure to register users on my web page:
With the following code, which basically consists of a form and an additional file for the "Back" button-link, which is the one I want to align with the other two buttons:
<form class="" method="post" action="index.php?fichero=registro.php">
<h2 class="titulo-registro display-4 text-center mt-5 mb-4">Alta de <span>usuario</span></h2>
<div class="form-group row">
<label class="col-2 col-form-label" for="nombre">Tu nombre</label>
<input class="col-10" id="nombre" type="text" minlength="3" maxlength="25" name="nombre" placeholder="Ejemplo: Indi3_Geek" required/>
<h6 class="col-2">hola</h6>
<small class="col-10 form-text text-muted">El nombre o apodo que prefieras con tal de que tenga al menos tres caracteres y no más de veinticinco</small>
</div>
<div class="form-group row">
<label class="col-2 col-form-label" for="correo">Un correo</label>
<input class="col-10" id="correo" type="email" minlength="3" maxlength="100" name="correo" placeholder="Ejemplo: [email protected]" required/>
<h6 class="col-2">hola</h6>
<small class="col-10 form-text text-muted">Utiliza una dirección de correo electrónico que utilices habitualmente en caso de que necesitemos contactar contigo</small>
</div>
<div class="form-group row">
<label class="col-2 col-form-label" for="contrasena">Una contraseña</label>
<input class="col-4" id="contrasena" type="password" name="contrasena" minlength="3" maxlength="25" placeholder="Mejor no dar ejemplos..." required/>
<label class="col-2 col-form-label" for="contrasena2">Confírmamela, anda</label>
<input class="col-4" id="contrasena2" type="password" name="contrasena2" minlength="3" maxlength="25" required/>
<h6 class="col-2">hola</h6>
<small class="col-10 form-text text-muted">De nuevo, sólo la restricción de los caracteres (entre 3 y 25)</small>
</div>
<div class="form-group">
<button class="btn btn-info" id="enviar" type="submit">¡Adelante!</button>
<button class="btn btn-info" type="reset" onclick ="return confirm('¿Desea borrar todos los datos?')">No me convence</button>
</div>
</form>
<?php include("volver.php"); ?>
The file volver.php
has the following code; the website stores cookies based on the values it acquires $_POST
so that if a user decides to enter the registration section and then wants to leave without registering, the website knows where to return and does not simply go to the index (I have saved it in a separate file because that button -turned into a link- appears in other parts of the web):
<?php
if($_COOKIE['inicio_decada'])
{
echo '<form method="post" action="index.php?fichero=decadas.php">';
echo '<button class="boton-volver" role="link" name="inicio_decada" value="'.$_COOKIE['inicio_decada'].'">Volver</button>';
echo '</form>';
}
else
{
echo '<form method="post" action="index.php?fichero=recopilatorios.php">';
echo '<button class="boton-volver" role="link" name="recopilatorio" value="'.$_COOKIE['recopilatorio'].'">Volver</button>';
echo '</form>';
}
?>
Well then, how could I make the Back button-link appear after the two buttons on the form?
A greeting and thanks in advance.
You could fix it like this:
ej: formAltaUsuario
form
with value equal to the form id (eg: form="formAltaUsuario"
).include("volver.php")
next to the buttons.Example