Return table value

0

I would like to return the value of my entire table to a change form or something, when clicked on my btn "see more", below the print of my screen:

Mycode:

echo '<form action="vermais.php" method="POST" accept-charset="utf-8" >';
echo '<table class="table">';

	echo '<tr>';
	echo '<td>Protocolo</td>';
	echo '<td>Nome</td>';
	echo '<td>Setor</td>';
	echo '<td>E-mail</td>';
	echo '<td>Prioridade</td>';
	echo '<td>Data cadastrada</td>';
	echo '<td>Status</td>';




	echo '</tr>';

	while($registro = mysqli_fetch_assoc($sql)){

		$id=$registro['id_status'];
		$st = ("SELECT * FROM status WHERE id=$id");
		$sql2 = mysqli_query($conexao,$st);
		$row = mysqli_fetch_array($sql2);
		$s = $row['nome'];

		if("Em analise" == $s){
			$cor="blue";
		}else if("Aprovado" == $s){
			$cor="green";
		}else if("Pendente" == $s){
			$cor = "purple";
		}else{
			$cor = "red";
		}

		echo '<tr>';
		echo '<td>'.$registro["protocolo"].'</td>';
		echo '<td>'.$registro["nome"].'</td>';
		echo '<td>'.$registro["setor"].'</td>';
		echo '<td>'.$registro["email"].'</td>';
		echo '<td>'.$registro["prioridade"]. '</td>';
		echo '<td>'.$registro["data_cadastro"]. '</td>';
		echo '<td style="color:'.$cor.'">'.$row["nome"].'</td>';
		if($s !='Aprovado'){
			echo '<td> <button type="submit" class="btn btn-primary">Ver mais</button>';
		}
		echo '</tr>';


	}





	echo '</table>';	

	echo '</form>';
    
asked by anonymous 04.01.2018 / 19:22

1 answer

0

You do not need to use a form on this page nor the submit button.

Uses the type button and the parent.location script by passing a single parameter:

<button type="button" class="btn btn-primary" onClick="parent.location=\'paginaDestino.php?id='.$registro["protocolo"].'\'">Ver mais</button>

HTML

echo '<table class="table">';

echo '<tr>';
  echo '<td>Protocolo</td>';
  echo '<td>Nome</td>';
  echo '<td>Setor</td>';
  echo '<td>E-mail</td>';
  echo '<td>Prioridade</td>';
  echo '<td>Data cadastrada</td>';
  echo '<td>Status</td>';
echo '</tr>';

while($registro = mysqli_fetch_assoc($sql)){

    $id=$registro['id_status'];
    $st = ("SELECT * FROM status WHERE id=$id");
    $sql2 = mysqli_query($conexao,$st);
    $row = mysqli_fetch_array($sql2);
    $s = $row['nome'];

    if("Em analise" == $s){
        $cor="blue";
    }else if("Aprovado" == $s){
        $cor="green";
    }else if("Pendente" == $s){
        $cor = "purple";
    }else{
        $cor = "red";
    }

    echo '<tr>';
      echo '<td>'.$registro["protocolo"].'</td>';
      echo '<td>'.$registro["nome"].'</td>';
      echo '<td>'.$registro["setor"].'</td>';
      echo '<td>'.$registro["email"].'</td>';
      echo '<td>'.$registro["prioridade"]. '</td>';
      echo '<td>'.$registro["data_cadastro"]. '</td>';
      echo '<td style="color:'.$cor.'">'.$row["nome"].'</td>';
    if($s !='Aprovado'){
        echo '<td> <button type="button" class="btn btn-primary" onClick="parent.location=\'paginaDestino.php?id='.$registro["protocolo"].'\'">Ver mais</button>';
    }
    echo '</tr>';

}

echo '</table>';

Destination page - change form

 $protocolo= $_GET['id'];

 SELECT * FROM TABELA WHERE protocolo=$protocolo

With this you mount a form to change the data for this protocol

 <form action= ...... 
 <input .......
 ..............
 <button type="submit" .....
 </form>
    
04.01.2018 / 22:50