Forum Moderators: coopster
I am new to using PHP and MYSQL.
When you view the form page why does it look different to how the script is written e.g. fixture date and season are below the drop down team names that you select. How do I change it so the season and date are at the top?
The page is a form which the administrator fills in for entering football results filling in the form either by a pull down menu or fill in the box
Below is a copy of the script :-
<?php
/* Program: results2.php
* Desc: Allows the Administrator to enter the football
* results which updates the tables.
*/
?>
<HTML>
<HEAD>
<TITLE>Results</TITLE>
<STYLE>
<!--
A {text-decoration: none; color:#00008B}
-->
</STYLE>
</HEAD>
<BODY BGCOLOR="FAFAD2" TEXT="00008B" LINK="00008B" VLINK="00008B" ALINK="00008B">
<?php
$user="root";
$host="localhost";
$password="";
$database = "Tadburnfc";
$connection = mysql_connect($host,$user,$password)
or die ("couldn't connect to server");
$db = mysql_select_db($database,$connection)
or die ("Couldn't select database");
echo "<form action='AddResult.php' method='post'>\n";
echo "<center>\n";
echo " <b><font face='Arial, Helvetica, sans-serif' size='+3' color='#0000FF'>Results</font></b>\n";
echo "</center>\n";
echo "<br>\n";
echo "<br>\n";
echo "<font face='Arial, Helvetica, sans-serif' size='+1' color='#0000FF'>\n";
echo "<p>Enter the football score on the form below!</p>\n";
echo "<br>\n";
echo "<br>\n";
echo "<font face='Arial, Helvetica, sans-serif' color='#0000FF'>\n";
echo "<table border='0'> \n";
echo "<tr><td align='right'>Season :</td>\n";
echo "<td><input type='text' name='season'
value='$season'
size='7' maxlength='7'> (enter season as 2003/04)</td>\n";
echo " <tr><td align='right'>Fixture Date :</td>\n";
echo " <td><input type='text' name='fixtureDate'
value='$fixtureDate'
size='12' maxlength='12'> (enter date as 2003-mm-dd)</td>\n";
echo " </tr> \n";
echo " <tr><td align='right'>Age Group :</td>\n";
$query = "SELECT DISTINCT age FROM leagueTable ORDER BY age";
$result = mysql_query($query)
or die ("Couldn't execute query.");
echo "<select name='age'>\n";
while ($row = mysql_fetch_array($result))
{
echo "<tr>\n";
extract($row);
echo "<td><option value='$age'></td>$age\n";
}
echo " </tr>\n";
echo " <tr><td align='right'>Division or League :</td>\n";
$query = "SELECT DISTINCT division FROM leagueTable ORDER BY division";
$result = mysql_query($query)
or die ("Couldn't execute query.");
echo "<select name='division'>\n";
while ($row = mysql_fetch_array($result))
{
extract($row);
echo "<td><option value='$division'></td>$division\n";
}
echo "</select>\n";
echo "</tr>\n";
echo " <tr><td align='right'>Home Team :</td>\n";
$query = "SELECT DISTINCT homeTeam FROM leagueTable ORDER BY homeTeam";
$result = mysql_query($query)
or die ("Couldn't execute query.");
echo "<select name='homeTeam'>\n";
while ($row = mysql_fetch_array($result))
{
extract($row);
echo "<td><option value='$homeTeam'><td>$homeTeam\n";
}
echo "</select>\n";
echo "</tr>\n";
echo "<tr><td align='right'>Home Score :</td>\n";
echo " <td><input type='text' name='homeScore'
value='$homeScore' size='3' maxlength='3'>\n";
echo "<tr><td align='right'>Away Team :</td>\n";
$query = "SELECT DISTINCT awayTeam FROM leagueTable ORDER BY awayTeam";
$result = mysql_query($query)
or die ("Couldn't execute query.");
echo "<select name='homeTeam'>\n";
while ($row = mysql_fetch_array($result))
{
extract($row);
echo "<option value='$awayTeam'>$awayTeam\n";
}
echo "</select>\n";
echo "</tr>\n";
echo " <tr><td align='right'>Away Score :</td>\n";
echo " <td><input type='text' name='awayScore'
value='$awayScore' size='3' maxlength='3'>\n";
echo "</table>\n";
echo "</font>\n";
echo "<p><input type='submit' value='Submit Result'>
<input type='submit' name='newbutton' value='Cancel'>
</form>\n";
?>
</body>
</html>
Any help to resolve my problem would be much appreciated.
Thanks.
Rgds,
<html>......<body...>
<?php
... or die ("Couldn't select database");?>
<form action='AddResult.php' method='post'>...
<td><input type='text' name='season'
value='<?php echo $season;?>' size='7' maxlength='7'>...
This way it may be easier to spot the problem, which is really some <td>.
If you still won't spot the problem, write here, and we'll try to go through your code step by step.
Best regards
Michal Cibor