0
I have an index.php page that contains the following script:
<html>
//cabeçalho...
<div id="conteudo">
</div>
<script type="text/javascript">
$(this).on('load',function(){
var dadosLink = 'nada';
var mercado = 'nada';
$.ajax({
url:'conteudo.php',
method: 'POST',
data:{ dados:dadosLink,
mercado:mercado
},
success: function(data)
{
$("#conteudo").html(data);
},
error: function(data)
{
$("#conteudo").html(data);
}
});
});
</html>
</script>
This page sends the variable data dadLink and marketplace for the content file.php
Follow the content.php file:
<?php require_once('Connections/Gymo.php');
$aba = $_POST['dados'];
$mercado = $_POST['mercado'];
if ($aba == "nada"){
echo '
<IFRAME name=Destaques src="mercadoria.php" frameBorder=0 style="overflow: scroll; height: 100vh; width: 100vw;" scrolling=no>
<div align="center"></div>
</IFRAME>
';}
And then the.php content takes the content from the.php merchandise page and sends it to the "content" div of the index.php page.
Follow my attempt at merchandise.php:
<?php
//Incluir a conexão com banco de dados
include_once('Connections/Gymo.php');
//Recuperar o valor da palavra
$setor = "alimento";
$mercado= "dia";
$mercado=$mercado;
//Pesquisar no banco de dados nome do curso referente a palavra digitada pelo usuário
$id= "SELECT id FROM $mercado";
$setor = "
SELECT * FROM banco_fotos
INNER JOIN $mercado ON `$mercado`.`id` = `banco_fotos`.`id`
where banco_fotos.setor like '%$setor%'
";
$resultado_setor = mysql_query($setor, $Gymo);
while($rows = mysql_fetch_assoc($resultado_setor)){
echo''.$rows['descrp'].''.$rows['de'].''.$rows['por'].;} ?>
Finally, the doubt:
How do I get the merchandise page.php to receive the variables that are declared in the content.php ($market and $tab)?
Because the browser informs every time that the variables $sector and $merchandise market.php are not declared!
I’ve been trying so hard to find this solution for days, but I can’t!
I also tried to use this iframe in the.php content, to try to recover the id and name attribute in the.php merchandise, but I couldn’t do it either:
<IFRAME name=Destaques src="mercadoria.php" id="'.$aba.'" name="'. $mercado .'""frameBorder=0 style="overflow: scroll; height: 100vh; width: 100vw;" scrolling=no>
<div align="center"></div>
</IFRAME>
There is a solution to this?
To make this exchange of information between iframe and the parent page, it must be in javascript or jquery.
– Sam
Thank you for the comment. Could you tell me how this is done, or where I can find out how to do it? Please
– Gymo