1
I’m having trouble recording in two different fields of a table using one <select>
that has two attributes name and <options>
with two value.
I used the code below, but it only recorded the first name with their respective value:
<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'];
$noticia = $_POST['noticia'];
$habi_noticia = $_POST['habi_noticia'];
$query = mysql_query("SELECT * FROM menu");
$res = mysql_fetch_array($query);
if(isset($_POST['noti'])){
$noticia = $_POST['noticia'];
$habi_noticia = $_POST['habi_noticia'];
$update = mysql_query("UPDATE menu SET noticia = '$noticia', habi_noticia = '$habi_noticia'");
if($update == ''){
echo "
<script language='javascript'>
window.alert('Erro ao Habilitar Link Noticias!');
</script>";
} else{
echo "
<meta http-equiv='refresh' content='0; URL= menu_halitar_link.php'>
<script language='javascript'>
window.alert('Link Noticias Habilitado com sucesso!');
</script>";
}
}
?>
<form name="noti" action="" method="POST" enctype="multipart/form-data">
<label>Habilitar o Link Noticias?</label><br /><br />
<select name="noticia" | name="habi_noticia" >
<option value='<li><a href="<?php echo $res['dominio'];?>noticias.php" class="nav1">Noticias</a></li><li class="divider"></li>' | value='Sim'>Sim</option>
<option value="" | value="Não">Não</option>
</select><input type="submit" name="noti" value="Atualizar" />
</form>
</div>
Can you save two values in different fields using Select? If so, how?
which select you’re talking about?
– RafaelTSCS
Just use a value and name for tags, with content redundancy you won’t be able to capture the values correctly.
– Rafael Kendrik