Jump to content

Listing editable fields multiple times, help


Mutley

Recommended Posts

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.
[code]<?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
}
}
?>[/code]

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.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.