Código PHP:
<?php
$bd = mysql_connect("servidor","usuario","contraseña ") or die ("No puedo conectarme a la Base de Datos");
mysql_select_db("basedatos");
$opt=$_POST['opt'];
if ($opt==1)
{
$nombre=$_POST['nombre'];
$sql="INSERT INTO encuesta (nombre,poblacion,respuesta) VALUES ('".$nombre."','".$poblacion."','".$respuesta."')";
$res=mysql_query($sql,$bd) or die (mysql_error());
//Con PHP:
header("Location: gracias.html");
//Con Javascript:
//echo '<script type="text/javascript">'."\n";
//echo 'window.location="gracias.html";';
//echo '</script>';
}
?>
<html>
<head>
<title>ENCUESTA "EL ALEPH"</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head>
<script languaje="javascript">
function verifica()
{
if (f.nombre.value=="")
{
alert ("Por favor ingrese su nombre");
return;
}
f.opt.value=1;
f.submit();
}
</script>
<body bgcolor="#FFCCCC">
<div align="center">
<p><font color="#0000FF" size="5" face="Verdana, Arial, Helvetica, sans-serif"><strong>ENCUESTA "EL ALEPH"</strong></font> </p>
<font face="Arial, Helvetica, sans-serif"><strong>
<table width="474" border="1">
<?php
$sql="SELECT * FROM tablatexto_encuesta";
$result= mysql_query($sql) or die(mysql_error());
if(mysql_num_rows($result)==0) die("No hay registros para mostrar");
while($row=mysql_fetch_array($result))
{
echo "
<tr>
<td align='center'>$row[titulo_encuesta] </td>
</tr>
<tr>
<td align='justify'> $row[texto_encuesta] </td>
</tr>";
}
?>
</p>
</table>
<p> </p>
<P>---Para participar, simplemente introduce los Datos que te pedimos a continuación---
</div>
<form name="f" method="POST">
<input type="hidden" name="opt">
<div align="center">
<center>
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="39%" id="AutoNumber1">
<tr>
<td width="50%"><font size="5">Nombre</font></td>
<td width="50%"><input type="text" name="nombre" size="20">
</p>
<tr>
<td width="50%"><font size="5">Población</font></td>
<td width="50%"><input type="text" name="poblacion" size="20">
</p>
<tr>
<td width="50%"><font size="5">Respuesta</font></td>
<td width="50%"><input type="text" name="respuesta" size="20">
</p>
</form>
</td>
</tr>
</table>
</div>
<p align="center">
<input type="button" value="Enviar" name="B3" onclick=verifica()></p>
</center>
</form>
</body>
</html>
Aun cuando te di el codigo, te recomiendo que te leas un poquito sobre la funcion "header" en PHP.net, te servira de mucho.