Hi all... I'm creating a form to insert into the table "formazioni" the formations of my fantasy soccer league...
I have a list of 24 available players for a given team and the nearby the name of the player I have to put a 3 selections radio buttons to select if the players is going to play in the starting eleven, or if he is a possible subsitute (7 players) or if he can stay home watching soccer on TV...
I used the $id_g as the name of the radio button in order to be able to send the different selection of each player BUT now I don't know how to insert to the DB Table the info I need...
the first part is the FORM...
<?PHP
$my_color_1='#CCCCCC';
$my_color_2='#F2F2F2';
$i=1;
$db = mysql_connect("localhost", "$dbuser", "") or die("Problem connecting");
mysql_select_db("$dbname",$db)or die("Problem selecting database");
$result = mysql_query("SELECT * FROM $infogirone WHERE id_s = $infosquadra AND (tesserato ='VERO' AND venduto='FALSO' AND info < '0') ORDER BY ruolo DESC",$db);
while($myrow = mysql_fetch_array($result))
{
$id_g = $myrow["id_g"];
$ruolo = $myrow["ruolo"];
$nome = $myrow["nome"];
$acq = $myrow["acq"];
$nome_A = $myrow["nome_A"];
if($i%2==0) {
$trcolor=$my_color_1;
} else {
$trcolor=$my_color_2;
}
$i++;
echo "<TR bordercolor='#3B4B62' bgcolor='$trcolor'>\n";
echo "<TD>\n";
echo "<font color=$color class='giocatori'>$nome</font>\n";
echo "</TD>\n";
echo "<TD>\n";
echo "<font color=$color class='giocatori'>$nome_A</font>\n";
echo "</TD>\n";
echo "<TD>\n";
echo "<font color=$color class='giocatori'>$ruolo</font>\n";
echo "</TD>\n";
echo "<TD>\n";
echo "<font color=$color class='giocatori'><B>$acq</B></font>\n";
echo "</TD>\n";
echo "<TD>\n";
echo "<input type='radio' name='$id_g' value='1' checked> Titolare";
echo "</TD>\n";
echo "<TD>\n";
echo "<input type='radio' name='$id_g' value='2'> Panchina";
echo "</TD>\n";
echo "<TD>\n";
echo "<input type='radio' name='$id_g' value='3'> Tribuna";
echo "</TD>\n";
}
?>
the SECOND PART is the input.php (and ths is NOT WORKING)
<HTML>
<HEAD><TITLE>INSERT Data via PHP</TITLE></HEAD><BODY>
<?PHP
include("dbinfo.inc.php");
$db = mysql_connect("localhost", "$dbuser", "") or die("Problem connecting");
mysql_select_db("$dbname",$db)or die("Problem selecting database");
$infosquadra = '9';
$infogirone = 'girone2';
$sql= "INSERT INTO formazioni VALUES ('$id_g','$ruolo','$infosquadra')";
?>
</BODY>
</HTML>
if you want you can see here it's not finished... )http://utenti.lycos.it/fantalimbo/forma.php
thanx for your help!!!
Roberto