I have a php page that receives values from a form (post) and wanted to print those results on paper.
It turns out that by clicking the button the value in textarea does not appear in the printout.
On the source page I have this form with textarea and a button to print, like this:
<form method="post">
<p><textarea name="textoImprimir" cols="" rows="" class="anamnese-tarea">quero imprimir este texto que acabei de digitar.</textarea></p>
<p><iframe src="imprimir.php" name="frame1" style="display:none;"></iframe>
<input type="button" onclick="frames['frame1'].print()" value="print!"></p>
</form>
On the print.php page I have this:
<?php
$textoImprimir = $_POST['textoImprimir'];
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Imprimir</title>
<style>
html, body { width:100%; height:100%; margin:0px; }
.fundo { background: url(../_imagens/fundo_print.png);
background-size: 100% 100%;
background-repeat: no-repeat;
}
@page {
size: A4;
margin: 15mm 15mm 15mm 15mm;
}
table { top:18%; bottom:20%; position:absolute; }
</style>
</head>
<body class="fundo">
<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="20%" align="center" valign="middle">ALGUM TEXTO</td>
</tr>
<tr>
<td height="80%" align="justify" valign="top"><?php echo $imprimir;?></td>
</tr>
</table>
</body>
</html>