En primer lugar me gustaría explicarles mi problema y luego mostrar los codes.
Tengo una pagina web la cual se conecta con una base de datos sql. Es una pagina turística móvil. Por lo tanto En la pagina donde esta el formulario esta en php, de ahi uno manda el formulario de contacto.
Pagina 1:
Código PHP:
<?php
include("conexion.php");
$id = $_GET["id"];
$email="SELECT `wp_v9je9t_term_relationships`.`object_id` , `wp_v9je9t_posts`.`ID` , `wp_v9je9t_term_taxonomy`.`term_taxonomy_id` , `wp_v9je9t_terms`.`name` , `wp_v9je9t_posts`.`post_title` , `wp_v9je9t_postmeta`.`meta_value` ,`wp_v9je9t_posts`.`guid`
FROM `wp_v9je9t_term_relationships` , `wp_v9je9t_term_taxonomy` , `wp_v9je9t_terms` , `wp_v9je9t_posts` , `wp_v9je9t_postmeta`
WHERE `wp_v9je9t_term_relationships`.`term_taxonomy_id` = `wp_v9je9t_term_taxonomy`.`term_taxonomy_id`
AND `wp_v9je9t_term_taxonomy`.`term_id` = `wp_v9je9t_terms`.`term_id`
AND `wp_v9je9t_term_taxonomy`.`taxonomy` = 'placecategory'
AND `wp_v9je9t_term_taxonomy`.`count` != 0
AND`wp_v9je9t_term_taxonomy`.`term_id` != 66
AND `wp_v9je9t_posts`.`ID` = `wp_v9je9t_term_relationships`.`object_id`
AND `wp_v9je9t_postmeta`.`post_id` = `wp_v9je9t_posts`.`ID`
AND `wp_v9je9t_postmeta`.`post_id` = `wp_v9je9t_term_relationships`.`object_id`
AND `wp_v9je9t_postmeta`.`meta_key` = 'email'
AND `wp_v9je9t_posts`.`post_status` = 'publish'
AND `wp_v9je9t_posts`.`post_type` = 'place'
AND `wp_v9je9t_posts`.`ID`=".$id ;
/* Peticiones */
$peticionemail = mysql_query($email,$conexion);
/* filas */
$filaemail = mysql_fetch_array($peticionemail);
?>
<html>
<head></head>
<body>
<?php echo '
<form method="post" action="envio.php?id='.$fila["ID"].'" id="myform" name="myform" >
<label for="nombre">Nombre:</label><input type="text" name="fname" id="nombre" />
<label for="mail">E-mail:</label><input type="text" name="femail" id="mail" />
<label for="telefono">Telefono:</label><input type="text" name="fphone" id="telefono" />
<label for="mensaje">Comentario:</label><textarea name="fcomment" id="mensaje" rows="5" cols="25"></textarea>
<div class="ui-grid-a">
<div class="ui-block-a"><input type="submit" name="mysubmit" value="Enviar" /></div>
<div class="ui-block-b"><input type="reset" value="Borrar" /></div>
</div>
</form>
'
?>
</body>
pagina 2
Código PHP:
<?php
include("conexion.php");
$id = $_GET["id"];
$email="SELECT `wp_v9je9t_term_relationships`.`object_id` , `wp_v9je9t_posts`.`ID` , `wp_v9je9t_term_taxonomy`.`term_taxonomy_id` , `wp_v9je9t_terms`.`name` , `wp_v9je9t_posts`.`post_title` , `wp_v9je9t_postmeta`.`meta_value` ,`wp_v9je9t_posts`.`guid`
FROM `wp_v9je9t_term_relationships` , `wp_v9je9t_term_taxonomy` , `wp_v9je9t_terms` , `wp_v9je9t_posts` , `wp_v9je9t_postmeta`
WHERE `wp_v9je9t_term_relationships`.`term_taxonomy_id` = `wp_v9je9t_term_taxonomy`.`term_taxonomy_id`
AND `wp_v9je9t_term_taxonomy`.`term_id` = `wp_v9je9t_terms`.`term_id`
AND `wp_v9je9t_term_taxonomy`.`taxonomy` = 'placecategory'
AND `wp_v9je9t_term_taxonomy`.`count` != 0
AND`wp_v9je9t_term_taxonomy`.`term_id` != 66
AND `wp_v9je9t_posts`.`ID` = `wp_v9je9t_term_relationships`.`object_id`
AND `wp_v9je9t_postmeta`.`post_id` = `wp_v9je9t_posts`.`ID`
AND `wp_v9je9t_postmeta`.`post_id` = `wp_v9je9t_term_relationships`.`object_id`
AND `wp_v9je9t_postmeta`.`meta_key` = 'email'
AND `wp_v9je9t_posts`.`post_status` = 'publish'
AND `wp_v9je9t_posts`.`post_type` = 'place'
AND `wp_v9je9t_posts`.`ID`=".$id ;
/* Peticiones */
$peticionemail = mysql_query($email,$conexion);
/* filas */
$filaemail = mysql_fetch_array($peticionemail);
$mensaje="";
$mensaje.="Contacto realizado por: Portal de Elqui App". "\n\n";
$mensaje.="Nombre: ".$_POST['fname']."\n";
$mensaje.="E-mail: ".$_POST['femail']."\n";
$mensaje.="Telefono: ".$_POST['fphone']."\n";
$mensaje.="Comentario: ".$_POST['fcomment']."\n";
$email_destiny= "[email protected]";
$subject="Consulta en Portal de Elqui app";
if (mail($email_destiny,$subject,$mensaje,"From: Contact<".$_POST['femail'].">")) {
echo '<p align="center"><b>Thanks for your comments</b></p>';
} else {
echo '<p align="center">Error '.$_POST['fname'].'</p>';
}
?>