-1
I want to record two fields of a table simultaneously, it would be the field "gale_fotos" and "gale_status" and I am using the code below, but it only records the field "gale_status" as No.
How do I have it recorded in the "gale_status" or SIM field when clicked on the YES option.
<div align="center" style=" padding:2px; border-right:solid 1px;float:left; width:210px; height:auto; float:left;">
<?php
include '../conexao.php';
$codigo = $_POST['codigo'];
$gale_fotos = $_POST['gale_fotos'];
$gale_status = $_POST['gale_status'];
$query = mysql_query("SELECT * FROM menu");
$res = mysql_fetch_array($query);
if(isset($_POST['gale'])){
$gale_fotos = $_POST['gale_fotos'];
$gale_status = $_POST['gale_status'];
$update = mysql_query("UPDATE menu SET gale_fotos = '$gale_fotos', gale_status = '$gale_status'");
if($update == ''){
echo "<script language='javascript'>
window.alert('Erro ao Habilitar Link Galeria de Fotos!');
</script>";
}else{
echo "<meta http-equiv='refresh' content='0; URL= menu_halitar_link.php'>
<script language='javascript'>
window.alert('Link Galeria de Fotos Habilitado com sucesso!');
</script>";
}}?>
<form name="gale" action="" method="POST" enctype="multipart/form-data">
<label>Habilitar o Link Galeria de Fotos?</label><br /><br />
<label>Sim</label>
<input type='radio' name='gale_fotos' value='<li><a href="<?php echo $res['dominio'];?>galeria.php" class="nav1">Galeria de Fotos</a></li><li class="divider"></li>' />
<input type='hidden' name='gale_status' value='Sim' /><br />
<label>Não</label>
<input type="radio" name="gale_fotos" value="" />
<input type="hidden" name="gale_status" value="Não" /><br />
<input type="submit" name="gale" value="Atualizar" />
</form>
</div>
Thank you for your attention.
Ivan, first thank you so much for your attention to my problem. But I tried with your tip and it didn’t work, he keeps getting Status No when I select Yes. I managed to get him to get the correct status, but only by making two forms, one for each Input Radio and Idden, but he gets two buttons to update. I will keep trying, getting public the solution. But if anyone can give me a help I will be grateful.
– Sergio Murilo Cabral
if(isset($_POST['gale'])){
$gale_fotos = $_POST['gale_fotos'];
$update = mysql_query("UPDATE menu SET gale_fotos = $gale_fotos'")or die(mysql_error());

if($gale_fotos != '<li><a href="<?php echo $res["dominio"];?>galeria.php" class="nav1">Galeria de Fotos</a></li><li class="divider"></li>'){
 $update = mysql_query("UPDATE menu SET gale_status = 'Sim'");
 }else{
 $update = mysql_query("UPDATE menu SET gale_status = 'Não'") ;
 }
I made this change, but it only takes one of the options. Shouldn’t it compare and save according to this comparison? People, please... HEELPP.....– Sergio Murilo Cabral
This is because the value returned from the gale_status field in PHP is always the second Hidden input of HTML. Try changing the values of the Hidden inputs and you will always return YES.
– user60252