Indent table Cell value and move to a Second PHP screen

Asked

Viewed 55 times

0

Hello,

I have a need and I have a great difficulty with PHP, some I managed to help me, I am creating a table with database information, and inside a cell I am putting an Onclick to open a second screen to show the detailing. I need that when the user click on a cell I receive the value of the same on the other page. Follow the code below.

            <?php
        $SQL = "SELECT * FROM tabela where id = '$_SESSION';";
        $BSG = $CONNEXT->prepare($SQL);
        $BSG->bindValue(':usr', $USER_, PDO::PARAM_STR);
        $BSG->execute();

        while ($RESP = $BSG->fetch(PDO::FETCH_ASSOC)) {
            //header('Content-Type: text/html; charset=iso-8859-1,utf-8;q=0.7,*;q=0.7');
            $percentagem = $RESP[quantidade] / $_erb * 100;
            $ta = "";
            if($RESP[taRaiz] != ""){
       //// preciso recuperar esse valor que esta na celula e abrir em outra
       //// pagina para efetuar uma outra consulta, coloquei google, mas eu 
       //// criar uma outra pagina para receber
                $ta = "<td href=\"\" onClick=\"window.open('http://google.com','Janela','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=600,height=300,left=25,top=25'); return false;\">$RESP[taRaiz]</td>";
            }else{
                $ta = "<td class=\style3\></td>";
            }
            echo ("<tr>
                <td class=\style3\>$RESP[rota]</td>
                    $ta
                <td class=\style3\>$percentagem%</td>
                </tr>");
        }
        ?>

1 answer

1


You can pass the value through Querystring, for that just change where you have google.com and add the value to pass. For example

$ta = "<td href=\"\" onClick=\"window.open('http://google.com?taRaiz={$RESP[taRaiz]}','Janela','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=600,height=300,left=25,top=25'); return false;\">$RESP[taRaiz]</td>";

And on the other page, to pick it up, you can use

<?php
$taRaiz = $_GET['taRaiz'];
// fazer o que precisas com esse valor

Browser other questions tagged

You are not signed in. Login or sign up in order to post.