Hi, I’m new to PHP nd this is a project we’ve been given to do this semster. I have three tables, players,fixtures and team. Now what I want/need the code to do is the following-
The user is presented with a table that has all the field names of the table team listed. Next to eeach field nama they can then select a players name from a drop down list box which is popu;ated with names from the players table. When the user clicks submit, the player name next to the corresponding field name for team gets saved into the team table as the value for that field.
My problem is this - I have no idea how to assign the value from the drop down list to the corresponding field name in the team table… Please help!
[php]
<?php //Include the database connection information. include('connect.php'); //Start the session. session_start(); //Get fixture id and declare variables. $fixture_id=$_GET['fixture_id']; $select=$_GET['update']; $submit=$_POST['submit']; //Because the form method at the end is POST if($select=='yes'){ //Team selection table with sdrop down boxes. //Table header. echo ""; echo "Position | Player<td | |
' . htmlentities($field) . ' | ' . htmlentities($value ) . ' | '; echo ''; $sql = "SELECT name FROM players"; $result = mysql_query($sql); //While loop to echo out the player names into the select box. echo ""; while ($row = mysql_fetch_array($result)) { echo "" . $row['name'] . ""; } echo ''; echo ' |
<input type=submit name='submit' value='Save team' |
Opponents | Date | Venue | Action |
$opponents | $date | $venue | Select Team |
[/php]