codepad
[
create a new paste
]
login
|
about
Language:
C
C++
D
Haskell
Lua
OCaml
PHP
Perl
Plain Text
Python
Ruby
Scheme
Tcl
<?php include("poo1.php"); #incluimos el archivo para poder sacar objetos de sus clases ?> <!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=iso-8859-1" /> <title>Registra Personas</title> </head> <body> <?php if(isset($_POST["txtNombre"]) && isset($_POST["txtApellido"]) ){ $p = new persona($_POST["txtNombre"], $_POST["txtApellido"]); echo "Usted ha registrado a ". $p->muestra_persona()."\n"; #aqui pueden serializar el objeto o guardarlo en una base de datos o por el estilo? #al final el objeto se destruye porque ha sido dispuesto asi en la clase persona, #pero aun asi el destructor es opcional ?> <a href="poo2.php">Regresar al formulario</a><br /><br /> <?php }else{?> <h2>Registra Personas</h2> <form id="frmPersona" name="frmPersona" method="post" action="poo2.php"> <table width="42%" border="1"> <tr> <td width="22%">Nombre:</td> <td width="78%"><input name="txtNombre" type="text" id="txtNombre" /></td> </tr> <tr> <td>Apellido:</td> <td><input name="txtApellido" type="text" id="txtApellido" /></td> </tr> <tr> <td colspan="2"><input type="submit" name="Submit" value="Enviar" /></td> </tr> </table> </form> <?php }?> </body> </html>
Private
[
?
]
Run code