estaba navegando por la web y encontre un post que me sirve mucho para la aplicacion que quiero programar en mi pagina. Explico.
Encontre en el siguiente link: http://www.webexperto.com/articulos/art/269/generar-documentos-de-word/
como generar un documento de word.
el codigo php es: (a este codigo lo llame genera.php)
Cita:
ahora bien el problema que tengo es que con ese script los datos estan siempre fijos <?php
// Lee la plantilla
$plantilla = file_get_contents('plantilla.rtf');
// Agregamos los escapes necesarios
$plantilla = addslashes($plantilla);
$plantilla = str_replace('\r','\\r',$plantilla);
$plantilla = str_replace('\t','\\t',$plantilla);
// Datos de la plantilla
$nombre = "Juan";
$apellido = "Perez";
$prefijo = "Sr.";
$curso = '"Programacion Web con PHP"';
$fecha = date("d-m-Y", time() - 7 * 24 * 60 * 60); // de esta manera el codigo no envejece :P
// Procesa la plantilla
eval( '$rtf = <<<EOF_RTF
' . $plantilla . '
EOF_RTF;
' );
// Guarda el RTF generado
file_put_contents("$apellido-$nombre-$fecha.rtf",$rtf);
?>
// Lee la plantilla
$plantilla = file_get_contents('plantilla.rtf');
// Agregamos los escapes necesarios
$plantilla = addslashes($plantilla);
$plantilla = str_replace('\r','\\r',$plantilla);
$plantilla = str_replace('\t','\\t',$plantilla);
// Datos de la plantilla
$nombre = "Juan";
$apellido = "Perez";
$prefijo = "Sr.";
$curso = '"Programacion Web con PHP"';
$fecha = date("d-m-Y", time() - 7 * 24 * 60 * 60); // de esta manera el codigo no envejece :P
// Procesa la plantilla
eval( '$rtf = <<<EOF_RTF
' . $plantilla . '
EOF_RTF;
' );
// Guarda el RTF generado
file_put_contents("$apellido-$nombre-$fecha.rtf",$rtf);
?>
// Datos de la plantilla
$nombre = "Juan";
$apellido = "Perez";
$prefijo = "Sr.";
$curso = '"Programacion Web con PHP"';
Yo necesitaria saber como puedo ingresar mediante formularios los datos, nombre, apellido, prefijo y curso.
se entiende?...
lo que pense fue hacer esto, (ayuda aqui por que estoy bastante perdido)
Cita:
pero se me va al carajo <html>
<head>
<title>Documento sin título</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<form method="post" action="genera.php">
<p>NOMBRE
<input type="text" name="nombre">
<br>
APELLIDO
<input type="text" name="apellido">
<br>
prefijo
<input type="text" name="prefijo">
<br>
curso
<input type="text" name="curso">
</p>
<p>
<input type="submit" name="Submit" value="Enviar">
</p>
</form>
</body>
</html>
<head>
<title>Documento sin título</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<form method="post" action="genera.php">
<p>NOMBRE
<input type="text" name="nombre">
<br>
APELLIDO
<input type="text" name="apellido">
<br>
prefijo
<input type="text" name="prefijo">
<br>
curso
<input type="text" name="curso">
</p>
<p>
<input type="submit" name="Submit" value="Enviar">
</p>
</form>
</body>
</html>
![lloron](http://static.forosdelweb.com/fdwtheme/images/smilies/chillando.png)