In this piece of code, I get what the url is sending and save the parameters in variáveis
to later pass them to a function
.
if(isset($_GET['funcao']) && $_GET['funcao'] == 'lereresponder'){
if (!empty($_GET['tipo']) &&
!empty($_GET['funcao']) &&
$_GET['funcao'] == 'lereresponder'){
$id = $_GET['id'];
$tipo = $_GET['tipo'];
lerresponder($id, $tipo);
}
}
In this next code that is function
I'm getting the parameters with the intention of building a view
through a query to the database using the parameters caught.
function lerresponder($id, $tipo){
global $pdo;
echo $id . '<br>';
echo $tipo . '<br>';
}
Well, I'm getting the arguments from if(isset($_GET['funcao']) ...
in function
to query the database.
Question 1:
Does the way I'm passing these parsions to function
Question 2: How to call this function? Thus: lereresponder($id, $tipo)
?
Putting the code and the file where I call function
, I repeated the lerresponder($id, $tipo);
3 times statement and it bothered me.
Question 3: Is this code correct?