Ver Mensaje Individual
  #6 (permalink)  
Antiguo 08/04/2011, 07:23
krel
 
Fecha de Ingreso: septiembre-2010
Mensajes: 12
Antigüedad: 13 años, 8 meses
Puntos: 0
Respuesta: Declaración de variables en PHP

Este es el código html del fichero html...en él está incluído el formulario.


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>formulario</title>
</head>

<body>
<h1>Comienzo pedido del apartado Novelas</h1>
<h2>Formulario del pedido</h2>
<form id="form1" name="form1" method="post" action="php2.php">
<table width="379" border="0">
<tr>
<td height="26">Libros</td>
<td>Cantidades</td>
</tr>
<tr>
<td><label>Novelas Cubanas</label></td>
<td> <input name="cubanas" type="text" id="cubanas" size="30" maxlength="30" /> </td>
</tr>
<tr>
<td><label>Novelas Españolas</label></td>
<td><input name="españolas" type="text" id="españolas" size="30" maxlength="30" /></td>
</tr>
<tr>
<td><label>Novelas Suecas</label></td>
<td><input name="suecas" type="text" id="suecas" size="30" maxlength="30" /></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type="submit" name="button" id="button" value="Enviar" /></td>
</tr>
</table>
</form>
<p>&nbsp;</p>
</body>
</html>



Este es el código del fichero php...

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Resumen del pedido</title>
</head>

<body>
<h1>Pedido de libros</h1>
<h2>Resumen del pedido</h2>
<?php
echo "<p> Orden procesada."; // Esto aparecerá en pantalla gracias al echo.
echo "<P> Muchas Gracias.";// Esto aparecerá en pantalla gracias al echo.

echo date ("jS F H:i"); // Esto aparecerá en pantalla gracias al echo

echo "<p> Su pedido es el siguiente: <br>";
echo "<br>"; // <br> Hace un salto de líneas.

// Declaración de las variables con el mismo nombre de los campos de introducción de textos para que el pedido se muestre en la pantalla de la página en php mediante el echo delante de las variables.

echo $cubanas."Novelas Cubanas <br>";
echo $españolas." Novelas Españolas <br>";
echo $suecas." Novelas Suecas <br>";




?>
<form id="form1" name="form1" method="post" action="Index2.html">
<input type="submit" name="button" id="button" value="Ir al formulario" />
</form>
<p>&nbsp;</p>
</body>
</body>
</html>