Simplemente insertar un link, por ejemplo:
<html>
<head>
<title>HTML con PHP – aprenderaprogramar.com</title>
</head>
<body>
Esto es una página HTML con código PHP incrustado.
<br />
<?phpecho "Esto es código PHP incrustado, aquí pones el código php que quieras."// Ahora termina el código php y seguimos con código html y ponemos el link al formulario?>
<a href=”http://aprenderaprogramar.com/formulario.html” title=”Volver a formulario”>Ir al formulario</a>
</body>
</html>
Javi,
antes de que veas el código te explico lo que quiero hacer:
Tengo un fichero html llamado selecciona_actividad_4.html, otro llamado sistema4.php y un tercero llamado formulario_insertar.html.
En selecciona_actividad_4.html puedo seleccionar (insertar, mostrar, eliminar o borrar un registro en una tabla mysql )a través de un radio button.
En sistema4.php se recibe la opción seleccionada en selecciona_actividad_4.html.
Ahora, cuando se ha pulsado la opción insertar, sistema4.php hace un link a formulario_insertar.html para recibir los datos del registro a insertar en la tabla mysql.
Los dos formularios usan el method="GET" y action="sistema4.php" (no se si esto trae problemas, pero no se cómo hacer para que sistema4.php pueda recibir los datos a insertar??).
código de selecciona_actividad_4.html:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title> Mi primera aplicación en la Web</title>
</head>
<body>
<h1> SELECCIÓN DE LA ACTIVIDAD A REALIZAR </h1>
<hr size="8px" color="blue" />
<hr size="8px" style="color: black; background-color: black; width:75%;" />
<form method="get"action="sistema4.php">
<br/> <br/>
Insertar un registro: <input name="actividad" value="insertar" type="radio"/>
<br/> <br/>
Mostrar registros: <input name="actividad" value="mostrar" type="radio"/>
<br/> <br/>
Eliminar registros: <input name="actividad" value="eliminar" type="radio"/>
<br/> <br/>
Consultar: <input name="actividad" value="consultar" type="radio"/>
<br/> <br/>
<input type="reset" value="Borrar la Selección" />
<input value="Realizar" type="submit" />
<hr size="8px" color="blue" />
<hr size="8px" style="color: black; background-color: black; width:75%;" />
</form>
</body>
</html>
El código de sistema4.php es:
<html> //Ejemplo de un sistema simple programado en php
<body>
<title> La respuesta del interpretador Php</title>
<?php //Recepción de los datos del primer formulario echo '<br/><br/>'; $actividad= $_GET['actividad']; if($actividad == "insertar") { //Insertar registros //<a href=”http://maldonaj.byethost13.com/sistemasdeinformacion/formulario_insertar.html” title=”Volver a formulario”>Ir al formulario</a>?>
<a href=”formulario_insertar.html” >Ir al formulario</a>
<?php //$link_BD= mysql_connect("sql210.byethost13.com", "b13_15246293", "****"); //mysql_select_db("b13_15246293_LucianoBaseDeDatos", $link_BD); //mysql_query("INSERT INTO alumnos VALUES ('90845629', 'Luciano', 'Maldonado', 'Tópicos especiales en Estadística', 15)", $link_BD); //mysql_query("INSERT INTO alumnos VALUES ('20200238', 'Malvy', 'Alviarez', 'Embriología', 19)", $link_BD); //mysql_close($link_BD); // Cerramos la conexion con la base de datos } if($actividad == "mostrar") { //Mostrar registros $link_BD = mysql_connect("sql210.byethost13.com", "b13_15246293", "****"); mysql_select_db("b13_15246293_LucianoBaseDeDatos", $link_BD); $registros_BD = mysql_query("SELECT * FROM alumnos", $link_BD); // Lectura de cada uno de los registros existentes while($fila = mysql_fetch_array($registros_BD)) {// $fila es un arreglo con todos los campos existentes en la tabla echo "<hr>"; echo "Cédula: ".$fila['cedula']."<br>"; echo "Nombre: ".$fila['nombre']."<br>"; echo "Apellidos: ".$fila['apellido']."<br>"; echo "Asignatura: ".$fila['asignatura']."<br>"; echo "Nota:".$fila['nota']."<br>"; } mysql_free_result($registros_BD); // Liberamos los registros mysql_close($link_BD); // Cerramos la conexion con la base de datos echo "<hr>"; } if($actividad == "eliminar") {//Eliminar registros $link_BD = mysql_connect("sql210.byethost13.com", "b13_15246293", "****"); mysql_select_db("b13_15246293_LucianoBaseDeDatos", $link_BD); mysql_query("DELETE FROM alumnos WHERE nota=19", $link_BD); mysql_close($link_BD); // Cerramos la conexion con la base de datos } if($actividad == "consultar") { //Consultar registros $link_BD = mysql_connect("sql210.byethost13.com", "b13_15246293", "****"); mysql_select_db("b13_15246293_LucianoBaseDeDatos", $link_BD); mysql_query("UPDATE alumnos set nota=19 WHERE nota=20", $link_BD); mysql_query("UPDATE alumnos SET nombre='Luciano' WHERE nombre='LUCIANO luciano'", $link_BD); mysql_close($link_BD); // Cerramos la conexion con la base de datos }?>
</body>
</html>
El código de formulario_insertar.html es:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title> Para Insertar un Registro</title>
</head>
<body>
<h1> DATOS DEL REGISTRO </h1>
<hr size="8px" color="blue" />
<hr size="8px" style="color: black; background-color: black; width:75%;" />
<form method="get"action="sistema4.php">
<br/> <br/>
NOMBRE: <input name="nombre" value="" type="text"/>
<br/> <br/>
APELLIDO: <input name="apellido" value="" type="text"/>
<br/> <br/>
CÉDULA: <input name="cedula" value="" type="text"/>
<br/> <br/>
ASIGNATURA: <input name="asignatura" value="" type="text"/>
<br/> <br/>
CALIFICACIÓN: <input name="nota" value="" type="text"/>
<br/> <br/>
<input type="reset" value="LIMPIAR LOS CAMPOS" />
<input value="ENVIAR" type="submit" />
<hr size="8px" color="blue" />
<hr size="8px" style="color: black; background-color: black; width:75%;" />
</form>
</body>
</html>
Un saludo y gracias