Query Result on another page

1

I would like to know how I can get the result of a query on a page of mine, fill a tag on another page;

Example:

I have a search page the amount of existing processes, when I click the button, let's assume that it returns me 75 as value.

I want to know, how do I get this 75 (result) and put it in a pre tag that is on another page? Thanks

    
asked by anonymous 24.02.2016 / 18:06

3 answers

1

Good afternoon!

You could get the value that was returned "75", pass via GET to another page, create the desired tag and position it in HTML with echo , eg:

<?php
   $var = $_GET['valor']; //valor 75
   $tag = "<h2>$var</h2>";
?>
<html>
<head> 

</head>
<body>
   <?php echo $tag ?> <!-- exibindo 75 em h2 -->
</body>
</html>

In this example I used "75" for the display, but I might as well use it as id, name, height, etc ... Or any other tag attribute.

    
25.02.2016 / 20:50
0

Place the value in one session variable and load the session on the other page, or load the other page with a query string in the address of the other page.

    
25.02.2016 / 20:54
0

You have performed a query on a php file, create an array and put the contents you want to display on the page, for example:

$data['titulo'] = "Aqui vai o título da página";

Place the contents you want, preferably the array is associative.

Then do the following:

extract($data, EXTR_PREFIX_ALL, "view");

Where $data is its array , EXTR_PREFIX_ALL is a constant that says all its variables will have a prefix, and "view" is the prefix that is a String of your choice. p>

In this case, within your code html , you should write like this:

<p><?php echo $view_titulo; ?></p>

Finally, in your code php , after the command extract you have to call one:

require_once "pagina.html";

That's how it works for me.

This W3Schools link can help: link

    
28.02.2016 / 01:42