Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Boa tarde Srs,
eu gostaria que minha página onde existem 2 iframes ,mostrasse relatórios através de uma variável enviada .
segue abaixo os arquivos.
formulario1.php
<form name="busca" method="post" action="relatorio2.php" target="pesquisa">
<table >
<tr>
<td><input type="text" name="material" style="width:85%;font-family:arial;font-size:10" placeholder="" value="">
<BR>
<input type="submit" name="botao" value="Pesquisar" class="btn btn-success" style="width:98%;font-family:arial;font-size:10" >
</td>
</tr>
</table>
</form>
no formulario2.php
<?php $material=$_POST['material'];
echo $material; ?>
<table id='form' class="table table-striped table-bordered table-hover" >
<tr>
<Td>
<iframe src="info1.php" name="pesquisa" width="500" height="3550" scrolling="yes" frameborder="0" style="border:0px"></iframe>
</td>
<Td>
<iframe src="info2.php" name="pesquisa" width="500" height="3550" scrolling="yes" frameborder="0" style="border:0px"></iframe>
</td>
</tr>
</TABLE>
no arquivo info1.php
<table id='form' class="table table-striped table-bordered table-hover" >
<!-- linhas -->
<tr>
<th width='25%'>
MATERIAIS
</th>
<th width='25%'>
N DE SERIE
</th>
<?php
$material=$_POST['material'];
$sql = "SELECT * FROM material WHERE
material='$material' ";
$res = mysql_query($sql);
while($linha = mysql_fetch_array($res)){
?>
<tr>
<td>
<font color='green'> <?php echo $linha['material'];?>
</td>
<td>
<font color='green'> <?php echo $linha['serie'];?>
</td>
</tr>
<?php
}
?>
</table>
no info2.php
<table id='form' class="table table-striped table-bordered table-hover" >
<?php
$material=$_POST['material'];
?>
<!-- linhas -->
<tr>
<th width='25%'>
MATERIAIS
</th>
<th width='25%'>
N DE SERIE
</th>
<?php
$material=$_POST['material'];
$sql = "SELECT * FROM vendas WHERE
material='$material' AND status='VENDIDO' ";
$res = mysql_query($sql);
while($linha = mysql_fetch_array($res)){
?>
<tr>
<td>
<font color='green'> <?php echo $linha['material'];?>
</td>
<td>
<font color='green'> <?php echo $linha['serie'];?>
</td>
</tr>
<?php
}
?>
</table>
se puderem ajudar...Oi Daniel bom dia,
funcionou sim....
Obgd!!!
Bom temos algumas coisas para fazermos.
como você vai chamar no iframe, ele não vai receber dados vindo via POST.
Formulario 2
<?php
$material = $_POST['material'];
echo $material;
?>
<table id='form' class="table table-striped table-bordered table-hover" >
<tr>
<Td>
<iframe src="info1.php?material=<?= $material ?>" name="pesquisa" width="500" height="3550" scrolling="yes" frameborder="0" style="border:0px"></iframe>
</td>
<Td>
<iframe src="info2.php?material=<?= $material ?>" name="pesquisa" width="500" height="3550" scrolling="yes" frameborder="0" style="border:0px"></iframe>
</td>
</tr>
</TABLE>
REPARE QUE NO INFO 1 e no INFO 2 eu troquei de POST por GET
INFO 1
<table id='form' class="table table-striped table-bordered table-hover" >
<!-- linhas -->
<tr>
<th width='25%'>
MATERIAIS
</th>
<th width='25%'>
N DE SERIE
</th>
<?php
$material = $_GET['material'];
$sql = "SELECT * FROM material WHERE
material='$material' ";
$res = mysql_query($sql);
while ($linha = mysql_fetch_array($res)) {
?>
<tr>
<td>
<font color='green'> <?php echo $linha['material']; ?>
</td>
<td>
<font color='green'> <?php echo $linha['serie']; ?>
</td>
</tr>
<?php
}
?>
</table>
INFO 2
<table id='form' class="table table-striped table-bordered table-hover" >
<!-- linhas -->
<tr>
<th width='25%'>
MATERIAIS
</th>
<th width='25%'>
N DE SERIE
</th>
<?php
$material=$_GET['material'];
$sql = "SELECT * FROM vendas WHERE
material='$material' AND status='VENDIDO' ";
$res = mysql_query($sql);
while($linha = mysql_fetch_array($res)){
?>
<tr>
<td>
<font color='green'> <?php echo $linha['material'];?>
</td>
<td>
<font color='green'> <?php echo $linha['serie'];?>
</td>
</tr>
<?php
}
?>
</table>Obgd Chagas...
a pane que eu tinha era nessa parte aki:
<iframe src="adm.php?pag=info1?material=<?php echo $material;?>"
eu ja tinha uma página dentro de outra(adm.php com o relatorio2.php),e qdo eu usei mais o iframe (info1.php e info2.php)... acabou n funcionando como eu qria
(as informações não chegavam na info1.php e na info2.php)
solucao foi fazer essa aki mesmo( adcionei algumas coisas que tinham na adm.php para o relatorio2.php) e utilizei:
<iframe src="info1.php?material=<?php echo $material;?>"
visto que o sinal de "?" direcionava a página para uma outra página....
rs...
enfim
<iframe src="info1.php?material=<?php echo $material;?>"
funcionou...