When calling an iframe inside a .php file, how to send a variable and receive it on the page pulled by the iframe?

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 data from the dataLink and market variables to the content.php file

Follow the file content.php:

<?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 conteudo.php takes the contents of the commodity.php 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'].;} ?>

At last, the doubt:

How do I get the merchandise.php page to receive the variables that are declared in the conteudo.php ($ market and $ aba)?

Because the browser informs every time that the variables $ sector and $ merchandise.php market are not declared!

I've been trying hard to find this solution for days, but I can not!

I also tried to use this iframe in the conteudo.php, to try to recover the attribute id and name in the merchandise.php, but also I could not:

<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>

Is there a solution to this?

    
asked by anonymous 16.09.2017 / 02:02

1 answer

1

GET method src=\"mercadoria.php?dados=".$aba."&mercado=".$mercado."\

if  ($aba == "nada"){
echo "

<IFRAME name=Destaques frameBorder=0 style=\"overflow: scroll; height: 100vh; width: 100vw;\"  scrolling=no src=\"mercadoria.php?dados=".$aba."&mercado=".$mercado."\" >
<div align=\"center\"></div>
</IFRAME>


";}

Merchandise page

$aba = $_GET['dados'];
$mercado = $_GET['mercado'];
    
16.09.2017 / 03:31