Ver Mensaje Individual
  #3 (permalink)  
Antiguo 04/03/2009, 13:00
gomminola
 
Fecha de Ingreso: mayo-2008
Mensajes: 253
Antigüedad: 16 años
Puntos: 8
Respuesta: insertar php en html

A ver si lo entiendo:

Archivo HTML = include("guest.php") dentro del div:
Archivo PHP =
Cita:
<?include "guest.php";?>
Mi archivo php
Cita:
<?php


$datafile = "msgs.data";


if(isset($_POST[content])) {
extract($_POST);

$oldarray = fopen("$datafile", "r");
$oldcontents = fread($oldarray, filesize($datafile)) or die( 'Could not read from file.');
fclose($oldarray);

if(!$fp = fopen("$datafile", "w")){
die("Error: PHP does not appear to have permission to write to $datafile");
}
fwrite ($fp, "<b>Posted by:</b> $name -- ");
fwrite ($fp, date("n/d/y h:i:s A"));
fwrite ($fp, "<br><b>Email:</b> <a href='mailto:$email'>$email</a><br>");
fwrite ($fp, "<b>Topic:</b> $title<br><br>");
fwrite ($fp, stripslashes($content) . "<br><hr noshade size=1><br>");

fwrite ($fp, $oldcontents);
fclose($fp);
header("Location: $_SERVER[PHP_SELF]");
}
?>


<!-- HTML Begins Here -->


<font size=2 style='font-family:Verdana'>
<center><a href="#postnew">Post a Message</a></center><p>

<?

require("$datafile");
?>

<br><br>
<a name="postnew"></a>
<form method="post" action="<? echo $_SERVER[PHP_SELF]; ?>">
Name: <input type="text" name="name"><br>
Email: <input type="text" name="email"><br>
Title: <input type="text" name="title"><br>
<textarea name=content rows=15 cols=50 wrap=soft></textarea>
<input type="submit" name="submitButton" value="Post">


<!-- HTML Ends Here -->
¿solo eso o hace falta algo mas? Muchas gracias