ciao a tutti,
questo è il mio primo post qui, vi chiedo anticipatamente scusa se ho commesso qualche errore.
Vi espongo il mio problema, ho 2 select form in html5 dove nel primo vengono elencati una serie di elementi che, a seconda della propria scelta, saranno inviati al secondo form tramite 1 tasto, e fin qui tutto ok. Dopo la scelta gli elementi devono essere registrati, tramite tasto, in un db MySQL, e qui mi blocco. Ovvero non riesco a inviare nel db gli elementi inviati al secondo form, di seguito riporto i file:
index.php:
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script language="javascript">
function getOpt(select1,select2)
{
for (bCnt=0;bCnt<select1.length;bCnt++)
{
if (select1.options[bCnt].selected)
{
newOpt=new
Option(select1.options[bCnt].text,select1.options[bCnt].value,false,false);
select2.options[select2.length]=newOpt;
}
}
}
function remOpt(select2)
{
for (bCnt=0;bCnt<select2.length;bCnt++)
{
if (select2.options[bCnt].selected)
select2.options[bCnt]=null;
}
}
</script>
</head>
<body>
<form id="form" action="addring_mysql.php" method="post" name="form1">
<fieldset>
<legend id="legend_new">Add Items</legend>
then the selects form:
<table border="0">
<tr>
<td>
<label for="id">List:
</label>
<select name="oneS" id="select_role" size=20 required multiple="multiple"/>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
</select>
</td>
<td>
<input type="button" value="Add"onClick="getOpt(this.form.oneS,this.for m.twoS)">
<input type="button" value="Remove"onClick="remOpt(this.form.twoS)">
</td>
<td>
<label for="id">Members List:
</label>
<select name="twoS" id="select_role" size=20 multiple="multiple"/>
</select>
</td>
</tr>
</table>
</fieldset>
<p id="submit">
<input type="submit" value="Save" />
</p>
</form>
</body>
</html>
addring_mysql.php:
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body onload="window.close()">
<?php
/* -------------------------------------------------------------------------- */
require 'mysql_connect.php';
require 'mysql_insert.php';
/* -------------------------------------------------------------------------- */
?>
</body>
</html>
mysql_insert.php:
<?php
/* ------------------------------------------------------------------------- */
$db_insert = mysql_query("INSERT INTO ring (id,ring,oneS) VALUES ('$id','$ring','oneS')") or die ("Error to insert the VoIP account to table users by query: " . mysql_error());
/* -----
qualcuno potrebbe aiutarmi grazie anticipatamente