Jump to content


Photo

Listing editable fields multiple times, help


  • Please log in to reply
No replies to this topic

#1 Mutley

Mutley
  • Members
  • PipPipPip
  • Advanced Member
  • 765 posts

Posted 28 September 2006 - 12:03 PM

I have a slight problem. It's confusing me, all the database stuff is set, I just don't know how to lay it out.

What I want is a table with a list of players in a team, these players are in a seperate database table so it includes them in a drop down box.

Theres 4 teams and I want it to know which team to edit. When you hit the submit button. So 4 seperate tables. Here is my mess of a code:

The numbers, 1 to 20 are the players, 20 players.
<?php
require_once("connection.php");
mysql_select_db("rufc");
if(isset($_GET['id'])){
$id = $_GET['id'];
$result = mysql_query("SELECT id, team, against, kickoff, against, side, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, date DATE_FORMAT(date,'%d-%m-%Y') AS dstamp FROM teamplayers WHERE id=".$id." ");
while($row = mysql_fetch_array( $result ))
    {
?>
<form action="update_confirm.php?id=1" method="POST">
<table width="90%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td>&nbsp;</td>
    <td>Team 1 Players: </td>
  </tr>
  <tr>
    <td>Against:</td>
    <td><input class="form" type="text" size="20" name="agaubst" value="<?=$row['against']; ?>">
</td>
  </tr>
    <tr>
    <td>Date:</td>
    <td><input class="form" type="text" size="8" name="date" value="<?=$row['dstamp']; ?>"></td>
  </tr>
  <tr>
    <td>Kick-off:</td>
    <td><input class="form" type="text" size="12" name="kickoff" value="<?=$row['kickoff']; ?>">
</td>
  </tr>
  <tr>
    <td>1</td>
    <td>
<select name="1">
<option value="<?=$row['1']; ?>"><?=$row['1']; ?></option>
<? include('playerlistdata.php'); ?>
</select>	</td>
  </tr>
  <tr>
    <td>2</td>
    <td>
<select name="2">
<option value="<?=$row['2']; ?>"><?=$row['2']; ?></option>
<? include('playerlistdata.php'); ?>
</select>	</td>
  </tr>
  <tr>
    <td>3</td>
    <td>
<select name="3">
<option value="<?=$row['3']; ?>"><?=$row['3']; ?></option>
<? include('playerlistdata.php'); ?>
</select>	</td>
  </tr>
  <tr>
    <td>4</td>
    <td>
<select name="4">
<option value="<?=$row['4']; ?>"><?=$row['4']; ?></option>
<? include('playerlistdata.php'); ?>
</select></td>
  </tr>
  <tr>
    <td>5</td>
    <td>
<select name="5">
<option value="<?=$row['5']; ?>"><?=$row['5']; ?></option>
<? include('playerlistdata.php'); ?>
</select></td>
  </tr>
  <tr>
    <td>6</td>
    <td>
<select name="6">
<option value="<?=$row['6']; ?>"><?=$row['6']; ?></option>
<? include('playerlistdata.php'); ?>
</select></td>
  </tr>
  <tr>
    <td>7</td>
    <td>
<select name="7">
<option value="<?=$row['7']; ?>"><?=$row['7']; ?></option>
<? include('playerlistdata.php'); ?>
</select></td>
  </tr>
  <tr>
    <td>8</td>
    <td>
<select name="8">
<option value="<?=$row['8']; ?>"><?=$row['8']; ?></option>
<? include('playerlistdata.php'); ?>
</select></td>
  </tr>
  <tr>
    <td>9</td>
    <td>
<select name="9">
<option value="<?=$row['9']; ?>"><?=$row['9']; ?></option>
<? include('playerlistdata.php'); ?>
</select></td>
  </tr>
  <tr>
    <td>10</td>
    <td>
<select name="10">
<option value="<?=$row['10']; ?>"><?=$row['10']; ?></option>
<? include('playerlistdata.php'); ?>
</select></td>
  </tr>
  <tr>
    <td>11</td>
    <td>
<select name="11">
<option value="<?=$row['11']; ?>"><?=$row['11']; ?></option>
<? include('playerlistdata.php'); ?>
</select></td>
  </tr>
  <tr>
    <td>12</td>
    <td>
<select name="12">
<option value="<?=$row['12']; ?>"><?=$row['12']; ?></option>
<? include('playerlistdata.php'); ?>
</select></td>
  </tr>
  <tr>
    <td>13</td>
    <td>
<select name="13">
<option value="<?=$row['13']; ?>"><?=$row['13']; ?></option>
<? include('playerlistdata.php'); ?>
</select></td>
  </tr>
  <tr>
    <td>14</td>
    <td>
<select name="14">
<option value="<?=$row['14']; ?>"><?=$row['14']; ?></option>
<? include('playerlistdata.php'); ?>
</select></td>
  </tr>
  <tr>
    <td>15</td>
    <td>
<select name="15">
<option value="<?=$row['15']; ?>"><?=$row['15']; ?></option>
<? include('playerlistdata.php'); ?>
</select></td>
  </tr>
  <tr>
    <td>16</td>
    <td>
<select name="16">
<option value="<?=$row['16']; ?>"><?=$row['16']; ?></option>
<? include('playerlistdata.php'); ?>
</select></td>
  </tr>
  <tr>
    <td>17</td>
    <td>
<select name="17">
<option value="<?=$row['17']; ?>"><?=$row['17']; ?></option>
<? include('playerlistdata.php'); ?>
</select></td>
  </tr>
  <tr>
    <td>18</td>
    <td>
<select name="18">
<option value="<?=$row['18']; ?>"><?=$row['18']; ?></option>
<? include('playerlistdata.php'); ?>
</select></td>
  </tr>
  <tr>
    <td>19</td>
    <td>
<select name="19">
<option value="<?=$row['19']; ?>"><?=$row['19']; ?></option>
<? include('playerlistdata.php'); ?>
</select></td>
  </tr>
  <tr>
    <td>20</td>
    <td><select name="19">
<option value="<?=$row['20']; ?>"><?=$row['20']; ?></option>
<? include('playerlistdata.php'); ?>
</select></td>
  </tr>
</table>

<input class="form" type="submit" value="Click to Update Playerlist">
</form>
<br /><br />
<?php
}
}
?>

So when I click submit, I want it to know which team it is out of the 4 and not just update all the teams with the same info.
~ Mutley.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users