Below, is the code of a form to predict some matches. What I want is to submit this
with with one button so it inserts the macthes in the database. One match is one
record.
The problem is that I don't know what to do now.
Can someone help me with this form and the insert file (addvoorspelling.php)
Thanks,
Martin.
<?PHP
$today = date( "Y-m-d H:i:s");
include("auth.php");
mysql_connect(".........", "...........", "..............");
mysql_select_db (..............);
$sql = "SELECT * FROM wedstrijden WHERE status='actief' AND datum > '$today' ORDER
BY datum";
$resultaat = mysql_query($sql);
$aantal = mysql_num_rows($resultaat);
$i = 0;
$queryr = "SELECT * FROM ronde WHERE status='actief'";
$resultr = MYSQL_QUERY($queryr) or die(mysql_error());
$aantalr = MYSQL_NUMROWS($resultr);
$start = mysql_result($resultr,$r,"start");
$einde = mysql_result($resultr,$r,"einde");
PRINT"
<link rel='stylesheet' href='centerstyle.css'>
<body bgcolor=#f5f5f5>
<CENTER>
<font size='5'>From $start to $einde</font><p>
<table> <tr>
<td width=300><b>Datum</b></td>
<td width=150><b>Home</b></td>
<td width=50></td>
<td width=150><b>Away</b></td>
<td colspan=2><b>HT</b></td>
<td colspan=2><b>FT</b></td>
<td></td>
</tr>";
WHILE ($i < $aantal):
$id_wedstr = mysql_result($resultaat,$i,"id_wedstr");
$home = mysql_result($resultaat,$i,"home");
$away = mysql_result($resultaat,$i,"away");
$datum = mysql_result($resultaat,$i,"datum");
$sqlv = "SELECT * FROM voorspelling WHERE id_user='$id' AND
id_wedstrijd='$id_wedstr'";
$resultaatv = mysql_query($sqlv);
$aantalv = mysql_num_rows($resultaatv);
IF ($aantalv == 0):
PRINT"
<form action=addvoorspelling.php method=POST>
<tr>
<td width=300>$datum</td>
<td width=150>$home</td>
<td width=50>-</td>
<td width=150>$away</td>
<td width=50><select size'1' name='ht_home'>
<option value='--'>--</option>";
$j = 0;
WHILE ($j < 11):
print"<option value='$j'>$j</option>";
$j++;
ENDWHILE;
PRINT"
</select></td>
<td width=50><select size'1' name='ht_aways'>
<option value='--'>--</option>";
$j = 0;
WHILE ($j < 11):
print"<option value='$j'>$j</option>";
$j++;
ENDWHILE;
PRINT"
</select></td>
<td width=50><select size'1' name='ft_home'>
<option value='--'>--</option>";
$j = 0;
WHILE ($j < 11):
print"<option value='$j'>$j</option>";
$j++;
ENDWHILE;
PRINT"
</select></td>
<td width=50><select size'1' name='ft_away'>
<option value='--'>--</option>";
$j = 0;
WHILE ($j < 11):
print"<option value='$j'>$j</option>";
$j++;
ENDWHILE;
PRINT"
</select></td>
<td><center>
<input type=hidden value='$id' name=id>
<input type=hidden value='$naam' name=naam>
<input type=hidden value='$id_wedstr' name=id_wedstr>
<input type=hidden value='$home' name=home>
<input type=hidden value='$away' name=away>
</center></td>
</tr>
<input type=submit Value=Verstuur!>
</form>";
ELSE:
ENDIF;
$i++;
ENDWHILE;
PRINT"</table> </CENTER>";
?>