Ver Mensaje Individual
  #1 (permalink)  
Antiguo 07/01/2010, 13:46
edugilc
 
Fecha de Ingreso: octubre-2009
Mensajes: 154
Antigüedad: 14 años, 6 meses
Puntos: 0
Sonrisa pasar variables entre forms

Hola!!
A ver si alguien me puede exar una mano:

Tengo en un menu varias opciones,todas funcionan bien.
Una de ellas es enviar_email,en la que tu poniendo a quien se lo quieres enviar el subject y el texto das a enviar y perfecto.
Otra de las opciones es buscar_email,dentro de una tabla tengo todos los emails,elijo uno y me muestra la informacion sobre ese email,y dentro de esa opcion cuando te muestra el email, puedes dar a un boton reenviar,que lo que hara sera ir directamnet a la opcion de menu de antes enviar_email y escribir en los huecos el texto del email y el subject,el problema es que eso ultimo no se muy bien como hacerlo.Os explico como lo tengo hecho.

La pregunta es muy sencilla,como puedo utilizar las variables que estan en amarillo dentro de write_email para poder mandarlas desde el template que se llama email_view donde muestro el email

Esta es el script k dirige buscar email:


session_start();

require_once('class.rc4crypt.php');
require_once('crypt.inc.php');


$table_id = R4decrypt($HTTP_POST_VARS['emailist']);

$id_crypt = $HTTP_POST_VARS['emailist'];



//------------------------------ main -------------------------------------------------------------------------


//get the information via http post

$button = $HTTP_POST_VARS['Search'];


//initialize the fast templates

$tpl = new FastTemplate(".");
$tpl->define(array("main" => "templates/search_email.tpl"));
$tpl->assign(SCRIPT,$PHP_SELF);
$tpl->assign(NAME, " Emails");
//$tpl->assign(DATE, date("Y-m-j"));



//------------------------------------------------------------------------------------------------------------------
set_data_mail(&$tpl,$idmail);



if ($button == 'Search')
{
write_email("templates/email_view.tpl");
}


$tpl->assign(BUTTONS, '<input class="buttons" type = "submit" value="Search" color=blue name="Search">');

//display the template
$tpl->parse(result, "main");
$tpl->FastPrint(result);
?>

-----------------------------------------------------------------------------------------------


write_email es la funcion k escribe el email en pantalla y que a su vez tiene asociado un template


function write_email($scriptname)
{
global $HTTP_POST_VARS;
global $MySQL;

$idmail = R4decrypt($HTTP_POST_VARS['emailist']);


//echo $ides;
$tpl = new FastTemplate(".");
$tpl->define(array("main" => $scriptname));


//if ( $table_id>0)

$sql = "select msg_id, text, sender, title, date, mailto_dir

from message

where (msg_id = '$idmail')";

$result = send_sql($MySQL->db1, $sql);


$tpl->assign(BUTTONS1, '<input class="buttons" type = "submit" value="Resend" color=blue name="Resend">');

$tpl->parse(result, "main");
$tpl->FastPrint(result); //print as main the correct file


if (!$result)
{
die ("Database Error");
}


($row = mysql_fetch_array($result));


echo('<br>');
echo('<b><font style="line-height: 110%;"><FONT SIZE="3" color=#0000A0> Sender: </FONT></b>'); echo ($row["sender"]);
echo('<br><br>');
echo('<b> <FONT SIZE="3" color=#0000A0> To: </FONT></b>'); echo ($row["mailto_dir"]);
echo('<br><br>');
echo('<b> <FONT SIZE="3" color=#0000A0> Subject: </FONT></b>'); echo ($row["title"]);
$subject = ($row["subject"]);
echo('<br><br>');
echo('<b> <FONT SIZE="3" color=#0000A0> Date: </FONT></b>'); echo ($row["date"]);
echo('<br><br><br><br>');
echo('<b> <FONT SIZE="3" color=#0000A0> Text: </FONT></b>');
echo('<br>');
$texto = ($row["text"]);
//$texto = nl2br($texto);// otra opcion igual k la de abajo pero sale mas grande!!
$texto = "<pre>($texto)</pre>";
echo ($texto);

exit();

}

------------------------------------------------------------------------------------------------------

Este es el template donde escribo los datos del email y con el action redirigo a la pagina de enviar email:


<html><head>
<title>Search Email</title>
<link href="templates/style/buttons.css" type=text/css rel=stylesheet>
<link href="templates/style/W3C-REC.css" type=text/css rel=stylesheet>

<script LANGUAGE="JavaScript" type="text/javascript">
<!--

var bV=parseInt(navigator.appVersion);
NS4=(document.layers)&&(bV>=4) ? true : false;
IE4=((document.all)&&(bV>=4)) ? true : false;
DOM= (!document.layers && !document.all && bV>=4) ? true : false; // A hack to guess if the browser supports the DOM
capable = (NS4 || IE4 || DOM) ? true : false;
function expandIt(){return;}

//-->
</script>

</HEAD>
<body textcolor=white >

<script LANGUAGE="JavaScript" type="text/javascript" SRC="templates/FX.js">
<!--
alert("Error, It Can't Load JavaScript LIBRARY");
//-->
</script>



</head>
<body textcolor=white >

<p align=LEFT>
<table width = 535 height="1" bordercolor="#000080" border="0">
<tr>
<td align = left width="33" valign="top" height="40" bgcolor="#000080">
&nbsp;
</td>
<td align = left width="637" valign="top" height="40" bgcolor="#000080">
<h1><font color=#FFFFFF> EMAIL SEARCHED</h1></font>
</td>
<form name="myform" method="POST" action="mailing_customer.php">

<td width ="30" align="center" valign="bottom">
{BUTTONS1}
</td>

</table>

</body>
</html>

Gracias!!!!!!!!!!