WeeGiE
04-11-2008, 12:47 PM
Hi all. I have a submit forum with the following fields you see below. I have the following fields home team, away team, home score and away score..but I want to add more fields of course I know how to do this...but the problem is when they submit the results it stores to my database I have all set up, but I want it so it then display on my website like the home away sections already do. Below I have also posted the other part of my code this is the section of code I'm having problems with I don't know what php code to put to display anyway other fields I wish to make for example Goal scores. Any help will be much appreciated.
<?php
if($user->data['is_registered'])
{
?>
<p class="main_text">
Please use this form to submit results. If you have any issues, please let us know on the forums.
<br /><br />
</p>
<div align="center" id="form">
<form action="insert.php" method="post">
<input name="HomeTeam" type="text" value="home team name" class="input" maxlength="25" />
<input name="AwayTeam" type="text" value="away team name" class="input" maxlength="25" />
<input name="HomeScore" type="text" value="0" class="input" maxlength="2" />
<input name="AwayScore" type="text" value="0" class="input" maxlength="2" />
<input name="League" type="text" value="League Name" class="input" maxlength="30" />
<input name="Submitter" type="hidden" value="<?php echo($user->data['username']);?>" />
<input name="Date" type="hidden" value="<?php $date = date("Y-m-d"); echo($date);?>" />
<div align="center"><input name="submit" type="submit" value="Submit Result" class="submit" /></div>
</form>
</div>
<?php
<?php
$con = mysql_connect("localhost","******","*****");
if (!$con)
{
die('Could not connect, please notify an admin: ' . mysql_error());
}
mysql_select_db("*******", $con);
$query = "SELECT hometeam, awayteam, homescore, awayscore, league, date FROM results ORDER BY id DESC";
$result = mysql_query($query);
?>
<div align="center"><table class="results_table">
<tr>
<td width="25%" class="results_header">Home Team:</td>
<td width="25%" class="results_header">Away Team:</td>
<td width="15%" class="results_header">Home Score:</td>
<td width="15%" class="results_header">Away Score:</td>
<td width="20%" class="results_header">Date:</td>
</tr>
<?php
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
?>
<tr>
<td class="results_data"><?php echo($row['hometeam']);?></td>
<td class="results_data"><?php echo($row['awayteam']);?></td>
<td class="results_data"><strong><?php if($row['homescore'] > $row['awayscore'])
{echo('<font color="green">');} else if($row['homescore'] < $row['awayscore']) { echo('<font color="red">');}
echo($row['homescore']);?>
</font></strong>
</td>
<td class="results_data"><strong><?php if($row['awayscore'] > $row['homescore'])
{ echo('<font color="green">');} else if($row['awayscore'] < $row['homescore']) { echo('<font color="red">');}
echo($row['awayscore']);?>
</font></strong>
</td>
<td class="results_data"><?php echo($row['date']);?></td>
</tr>
<?php
}
?>
<?php
if($user->data['is_registered'])
{
?>
<p class="main_text">
Please use this form to submit results. If you have any issues, please let us know on the forums.
<br /><br />
</p>
<div align="center" id="form">
<form action="insert.php" method="post">
<input name="HomeTeam" type="text" value="home team name" class="input" maxlength="25" />
<input name="AwayTeam" type="text" value="away team name" class="input" maxlength="25" />
<input name="HomeScore" type="text" value="0" class="input" maxlength="2" />
<input name="AwayScore" type="text" value="0" class="input" maxlength="2" />
<input name="League" type="text" value="League Name" class="input" maxlength="30" />
<input name="Submitter" type="hidden" value="<?php echo($user->data['username']);?>" />
<input name="Date" type="hidden" value="<?php $date = date("Y-m-d"); echo($date);?>" />
<div align="center"><input name="submit" type="submit" value="Submit Result" class="submit" /></div>
</form>
</div>
<?php
<?php
$con = mysql_connect("localhost","******","*****");
if (!$con)
{
die('Could not connect, please notify an admin: ' . mysql_error());
}
mysql_select_db("*******", $con);
$query = "SELECT hometeam, awayteam, homescore, awayscore, league, date FROM results ORDER BY id DESC";
$result = mysql_query($query);
?>
<div align="center"><table class="results_table">
<tr>
<td width="25%" class="results_header">Home Team:</td>
<td width="25%" class="results_header">Away Team:</td>
<td width="15%" class="results_header">Home Score:</td>
<td width="15%" class="results_header">Away Score:</td>
<td width="20%" class="results_header">Date:</td>
</tr>
<?php
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
?>
<tr>
<td class="results_data"><?php echo($row['hometeam']);?></td>
<td class="results_data"><?php echo($row['awayteam']);?></td>
<td class="results_data"><strong><?php if($row['homescore'] > $row['awayscore'])
{echo('<font color="green">');} else if($row['homescore'] < $row['awayscore']) { echo('<font color="red">');}
echo($row['homescore']);?>
</font></strong>
</td>
<td class="results_data"><strong><?php if($row['awayscore'] > $row['homescore'])
{ echo('<font color="green">');} else if($row['awayscore'] < $row['homescore']) { echo('<font color="red">');}
echo($row['awayscore']);?>
</font></strong>
</td>
<td class="results_data"><?php echo($row['date']);?></td>
</tr>
<?php
}
?>