1
Using a repeating structure while
I want to send predefined data.
I’ll try to show.
Database: name:(John,Paul,Victor) mode:(0,0,0)
page1.php
<?php
session_start();
include_once("config.php");
?>
<?php
$sql = $db->query("SELECT nome,modo FROM banco_de_dados");
?>
<?php
while($dados = $sql->fetch_array()){
$nome = $dados['nome'];
$modo = $dados['modo'];
$_SESSION['nome_id'.$num] = $nome;
$num++;
?>
<center>
NOME: <?php
echo $nome;
?> |
<?php
echo $modo;
?> |
<a href="pagina2.php" role="button">ON//OFF</a><br>
</center>
<?php
}
?>
page2.php
<?php
session_start();
require_once 'pagina1.php';
$sql_up = "UPDATE bando_de_dados SET modo = ('1') WHERE nome = '$nome'" ;
$up = mysqli_query($db, $sql_up);
?>
By clicking on on//off
, mute 0
for 1
.(Will change from 1 by 1, according to the click)
As well as predicted data?
– I_like_trains
It seems to me that he wants to know how to send a parameter to
pagina2.php
– Pagotti
example: name:(Joao,Gabriel,Vitor) mode:(0,0,0)
– Vitor Carvalho