Código PHP:
<?php
$server = "localhost";
$db_user = "";
$db_pass = "";
$base = "tinogrm";
$con=mysql_connect($server,$db_user,$db_pass);
mysql_select_db($base,$con);
if (!isset($pagina))
$pagina = 0;
$cantidad=5;
$inicial = $pagina * $cantidad;
$pegar = "SELECT * FROM guestbook ORDER BY id LIMIT $inicial,$cantidad";
$cad = mysql_db_query($base,$pegar) or die (mysql_error());
$contar = "SELECT * FROM guestbook ORDER BY id";
$contarok= mysql_db_query($base,$contar);
$total_records = mysql_num_rows($contarok);
$pages = intval($total_records / $cantidad);
echo "<table width='100%'>";
//Arreglo que contiente el nombre de los países
$nombrepais = array("Cuba","Afganistán","Albania","Alemania","Andorra","Angola","Arabia Saudí","Argelia",
"Argentina","Armenia","Australia","Austria","Bélgica","Bolivia","Brasil","Bulgaria","Canadá","Chile","China",
"Colombia","Corea del Sur","Costa Rica","Croacia","Checa, República","Dinamarca","Dominicana, República",
"Ecuador","Egipto","El Salvador","Emiratos Árabes Unidos","España","Estados Unidos de América","Filipinas",
"Finlandia","Francia","Gibraltar","Grecia","Guatemala","Guinea Equatorial","Haití","Hong Kong","Hungría",
"India","Indonesia","Irlanda","Israel","Italia","Japón","Jordania","Líbano","Luxemburgo","Malasia","Marruecos",
"México","Mónaco","Nicaragua","Nigeria","Nueva Zelanda","Noruega","Países Bajos","Pakistán","Panamá","Paraguay",
"Perú","Polonia","Portugal","Puerto Rico","Reino Unido","Rumanía","Rusia","Singapur","Sudáfrica",
"Suecia","Suiza","Taiwán","Tailandia","Turquía","Ucrania","Uruguay","Venezuela","Yugoslavia (ex)","Otro país");
while($array = mysql_fetch_array($cad)) {
echo "Nombre: ".$array['name']."<br>";
//echo "<a href=\"javascript:VentanaPopUpMail('mailto.php')\">".$array['email']."</a>";
echo "Correo Electrónico: <a href=\"javascript:VentanaPopUpMail('mailto.php')\">".$array['email']."</a><br>";
echo "Sitio Web: <a href=".$array['url']." target=\"_blank\">".$array['url']."</a><br>";
echo "País: ".$nombrepais[$array['pais']-1]."<br>";
echo "Comentarios: ".$array['comments']."<br><br><hr noshade color=\"#CCCCCC\" size=\"1\">";
if ($colorfila==0){
$color= "#DEDEBE";
$colorfila=1;
}else{
$color="#F0F0F0";
$colorfila=0;
}
echo "<tr><td bgcolor='".$color."'>
<font face='Tahoma' size='2'>".$array['titulo_cabecera']."</font></td></tr>";
}
echo "</table>";
$con=mysql_close($con);
echo "<p>";
if ($pagina <> 0)
{
$url = $pagina - 1;
echo "<a href='show.php?pagina=".$url."'>« Anterior</a> ";
}
else {
echo " ";
}
for ($i = 0; $i<($pages + 1); $i++) {
if ($i == $pagina) {
echo "<font face='Tahoma' size=2 color=CCCCC><b> $i </b></font>";
}
else {
echo "<a href='show.php?pagina=".$i."'>".$i."</a> ";
}
}
if ($pagina < $pages) {
$url = $pagina + 1;
echo "<a href='show.php?pagina=".$url."'>Siguiente »</a>";
}
else {
echo " ";
}
echo "</p>";
?>
Código PHP:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>.: Envío de Correo Electrónico :.</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="../tinogrm.css" rel="stylesheet" type="text/css">
</head>
<body background="/jc/images/back.gif" topmargin="1">
<table width="45%" border="1" cellpadding="0" cellspacing="0" bordercolor="#003366">
<tr>
<td><form name="mail" method="post" action="mailsend.php">
<table width="88%" align="center" cellpadding="0" cellspacing="2" bordercolor="#003366">
<tr>
<td colspan="2"><div align="center"><strong>Formulario de envío de Correo Electrónico</strong></div></td>
</tr>
<tr>
<td colspan="2"><hr color="#CCCCCC" noshade size="1"></td>
</tr>
<tr>
<td width="46%">Nombre del Remitente:</td>
<td width="54%"><input name="from" type="text" id="name3" size="45" maxlength="50">
</td>
</tr>
<tr>
<td height="28">Correo Electrónico:</td>
<td><input name="fromemail" type="text" id="fromemail" size="45" maxlength="150">
</td>
</tr>
<tr>
<td>Asunto:</td>
<td><input name="subject" type="text" id="subject" size="45"></td>
</tr>
<tr>
<td>Para:</td>
<td><input name="foremail" type="text" id="foremail" size="45" maxlength="250" value="Aqui es donde quiero poner el valor de la variable">
</td>
</tr>
<tr>
<td colspan="2"><div align="center">
<textarea name="content" cols="45" rows="5" wrap="VIRTUAL" id="textarea2"></textarea>
</div>
</td>
</tr>
<tr>
<td colspan="2"><div align="center">
<input name="envia" type="submit" id="firma3" onClick="MM_validateForm('namelastname','','R','email','','RisEmail','comentarios','','R');return document.MM_returnValue" value="Enviar correo">
<input name="borrar" type="reset" id="borrar3" value="Borrar datos">
</div>
</td>
</tr>
</table>
</form></td>
</tr>
</table>
</body>
</html>