I'm having troubles trying to insert and delete using a dropdown menu at the same time
<div id="blabla">
<div style="position: relative;">
<p style="position: absolute; top: 185px; left: 58px;">
<select name="lista">
<option selected="selected"></option>
<optgroup label="Selecciona">
<option> Option 1</option>
<option> Option 2</option>
<option> Option 3</option>
<option> Option 4</option>
<option> Option 5</option>
</optgroup>
</select>
and this is the ADD.php code
<html>
<head>
</head>
<body>
<?php
if(isset($_POST['justifica']) && !empty($_POST['justifica']) &&
isset($_POST['si']) && !empty($_POST['si']) &&
isset($_POST['lista']) && !empty($_POST['lista']))
{
mysql_connect("123", "123", "p123") or die(mysql_error()) ;
mysql_select_db("123") or die(mysql_error()) ;
mysql_query("INSERT INTO dos (lista,justifica,si) VALUES ('$_POST[lista]','$_POST[justifica]','$_POST[si]')");
mysql_query("DELETE FROM dos2 WHERE lista5='$_POST[lista]')");
if ($_POST['value'] === '') {
$_POST['value'] = null; // null en mayuscula si es SQL
}
echo "<img src=imagenes/Satisf.jpg>";
}else{
echo "<img src=imagenes/Error.jpg>";
}
?>
</body>
</html>
I want to INSERT
into table name "dos" and, at the same time, DELETE
from table name "dos2" when I press the Submit button
On form "Option1" will insert "Option1" on table "dos" and, at the same time, delete "Option1" from table "dos2".