Se hia biosgno chiama pure!!!
1) posso inviare dopo il form dove scelgo il numero dalla select e cancellare dal db il numero che ho scelto dalla select?
certamente! come vedi dall'html ogni OPTION ha come value il valore di quel campo..per poterlo cancellare dal DB fai così:
Codice PHP:
<?
$numero = $_POST['select'];
if ($numero) {
$link = mysql_connect('host', 'user', 'pass') or die ('Collegamento impossibile!');
$db = mysql_select_db('db');
$sql = "DELETE FROM numeri WHERE mposs=".$numero;
if ($result = mysql_query($link, $sql))
echo "numero cancellato!";
mysql_free_result($result);
mysql_close($link);
}
?>
<html>
<head><title></title></head>
<body>
<form name="form1" method="post" action="$_SERVER['PHP_SELF']">
<p align="center">
<select name="select" size="1" name="select">
<?
$link = mysql_connect('host', 'user', 'pass') or die ('Collegamento impossibile!');
$db = mysql_select_db('db');
$sql = "SELECT numeri.mposs FROM numeri ORDER BY numeri.mposs";
if ($result = mysql_query($link, $sql)) {
while ($row=mysql_fetch_array($result, MYSQL_BOTH))
echo "<option value=\"".$row[0]."\">".$row[0]."</option>";
}
mysql_free_result($result);
mysql_close($link);
?>
</select>
</p>
<input type="submit" value="OK" /></p>
</form>
</html>
2) Se voglio aggiungere altri numeri alla tabella "numeri" che query uso?
Codice PHP:
<?
$numero = $_POST['numero];
if ($numero) {
$link = mysql_connect('host', 'user', 'pass') or die ('Collegamento impossibile!');
$db = mysql_select_db('db');
$sql = "INSERT INTO numeri(mposs) VALUES ($numero)";
if ($result = mysql_query($link, $sql))
echo "numero inserito!";
mysql_free_result($result);
mysql_close($link);
}
?>
<html>
<head><title></title></head>
<body>
<form id="form1" method="post" action="$_SERVER['PHP_SELF']">
Numero da aggiungere: <input type="text" name="numero" />
<input type="submit" value="OK" />
</form>
</html>