Posting all results of fetch array with one submit button?

[php]<?phpsession_start(); // Maintain session stateheader("Cache-control: private"); // Fixes IE6's back button problem.$page_title = "Class Information"; include('header.php');$class_id = $_GET['id'];$enter = $_POST['enter_horse'];$horse_id = $_POST['horse_id']; //general show information$result = @mysql_query("SELECT s.show_id, s.player_id, s.type, s.name, DATEDIFF(s.run_date, NOW()) AS datedif, c.class_id, s.entry_fee FROM classes c, shows s WHERE c.class_id='$class_id' AND c.show_id=s.show_id LIMIT 1")or die("Cannot find class! " . mysql_error());$row = @mysql_fetch_array($result); $show_id = $row['show_id']; $show_name = $row['name']; $runs_in = $row['datedif']; $species = $row['species']; $type = $row['type']; $owner_id = $row['player_id']; if(!$row['class_id']){myError("Invalid class!");include('footer.php');} $entry_fee = $row['entry_fee']; $num_entries = @mysql_num_rows(@mysql_query("SELECT horse_id FROM horses_entered WHERE class_id='$class_id'")); $runs_in = "$runs_in day[s]"; if($enter){ //ensure horse is eligible to enter $good = @mysql_num_rows(@mysql_query("SELECT horse_id FROM horses WHERE horse_id='$horse_id' AND player_id='$player_id' AND age>=4 AND age<=20")); $exists = @mysql_num_rows(@mysql_query("SELECT horse_id FROM horses_entered WHERE horse_id='$horse_id' AND class_id='$class_id' LIMIT 1")); if($my_money < $entry_fee){myError("You cannot afford the entry fee.", 1);} if(!$good){myError("Are you sure you own the horse and it is between 4 and 20 years of age?"); }elseif($exists){myError("That horse is already entered in this class!"); }else{ @mysql_query("INSERT INTO horses_entered(horse_id, class_id) VALUES('$horse_id', '$class_id')")or die("Cannot create entry!"); if($type == 1 AND $entry_fee){@mysql_query("UPDATE players SET money=money+'$entry_fee' WHERE player_id='$owner_id' LIMIT 1")or die("Cannot update player money!"); $points=1; }elseif($type == 2 AND $entry_fee){@mysql_query("UPDATE clubs SET money=money+'$entry_fee' WHERE president='$owner_id' LIMIT 1")or die("Cannot update player money2!"); $points=2;} @mysql_query("UPDATE players SET money=money-'$entry_fee', points=points+'$points' WHERE player_id='$player_id' LIMIT 1")or die("Cannot update player money3! " . @mysql_error()); @mysql_query("UPDATE horses SET points=points+'$points' WHERE horse_id='$horse_id' LIMIT 1")or die("Cannot update horse points!"); myError("Class entered!"); }} //display the show informationecho "

Class: #$class_id
Show: $show_name (#$show_id)
Runs: $runs_in
Entry Fee: $$entry_fee
Total Entrants: $num_entries
Your Horses: ";$result = @mysql_query("SELECT horse_name, breed, horse_id FROM horses WHERE player_id='$player_id' AND age>3 AND age<=20 ORDER BY horse_name ASC")or die("Cannot find horses! " . mysql_error());while($row = @mysql_fetch_array($result)): $horse_id = $row['horse_id']; $horse_name = stripslashes($row['horse_name']); $breed = $row['breed']; echo "$horse_name (#$horse_id), $breed\n"; $prev_species = $species;endwhile;if(!$horse_id){echo "No eligible horses!";} echo "   
Entrants: "; $query = "SELECT h.horse_name, h.horse_id, h.breed FROM horses_entered he LEFT JOIN horses h ON he.horse_id=h.horse_id WHERE he.class_id='$class_id' ORDER BY h.horse_name ASC";$result = @mysql_query($query)or die(mysql_error());while($row = @mysql_fetch_array($result)): $name = $row['horse_name']; $aid = $row['horse_id']; $breed = $row['breed']; $page = "horses.php"; echo "$name (#$aid), $breed
\n";endwhile;if(!$aid){echo "No entrants.";}echo "
"; include('footer.php');?><?php
session_start(); // Maintain session state
header(“Cache-control: private”); // Fixes IE6’s back button problem.
$page_title = “Class Information”;

include(‘header.php’);
$class_id = $_GET[‘id’];
$enter = $_POST[‘enter_horse’];
$horse_id = $_POST[‘horse_id’];

//general show information
$result = @mysql_query(“SELECT s.show_id, s.player_id, s.type, s.name, DATEDIFF(s.run_date, NOW()) AS datedif, c.class_id, s.entry_fee FROM classes c, shows s WHERE c.class_id=’$class_id’ AND c.show_id=s.show_id LIMIT 1”)or die("Cannot find class! " . mysql_error());
$row = @mysql_fetch_array($result);
$show_id = $row[‘show_id’];
$show_name = $row[‘name’];
$runs_in = $row[‘datedif’];
$species = $row[‘species’];
$type = $row[‘type’];
$owner_id = $row[‘player_id’];
if(!$row[‘class_id’]){myError(“Invalid class!”);include(‘footer.php’);}
$entry_fee = $row[‘entry_fee’];
$num_entries = @mysql_num_rows(@mysql_query(“SELECT horse_id FROM horses_entered WHERE class_id=’$class_id’”));
$runs_in = “$runs_in day[s]”;

if($enter){
//ensure horse is eligible to enter
$good = @mysql_num_rows(@mysql_query(“SELECT horse_id FROM horses WHERE horse_id=’$horse_id’ AND player_id=’$player_id’ AND age>=4 AND age<=20”));
$exists = @mysql_num_rows(@mysql_query(“SELECT horse_id FROM horses_entered WHERE horse_id=’$horse_id’ AND class_id=’$class_id’ LIMIT 1”));
if($my_money < $entry_fee){myError(“You cannot afford the entry fee.”, 1);}
if(!$good){myError(“Are you sure you own the horse and it is between 4 and 20 years of age?”);
}elseif($exists){myError(“That horse is already entered in this class!”);
}else{
@mysql_query(“INSERT INTO horses_entered(horse_id, class_id) VALUES(’$horse_id’, ‘$class_id’)”)or die(“Cannot create entry!”);
if($type == 1 AND $entry_fee){@mysql_query(“UPDATE players SET money=money+’$entry_fee’ WHERE player_id=’$owner_id’ LIMIT 1”)or die(“Cannot update player money!”); $points=1;
}elseif($type == 2 AND $entry_fee){@mysql_query(“UPDATE clubs SET money=money+’$entry_fee’ WHERE president=’$owner_id’ LIMIT 1”)or die(“Cannot update player money2!”); $points=2;}
@mysql_query(“UPDATE players SET money=money-’$entry_fee’, points=points+’$points’ WHERE player_id=’$player_id’ LIMIT 1”)or die("Cannot update player money3! " . @mysql_error());
@mysql_query(“UPDATE horses SET points=points+’$points’ WHERE horse_id=’$horse_id’ LIMIT 1”)or die(“Cannot update horse points!”);
myError(“Class entered!”);
}
}

//display the show information
echo "

Class: #$class_id
Show: $show_name (#$show_id)
Runs: $runs_in
Entry Fee: $$entry_fee
Total Entrants: $num_entries
Your Horses: "; $result = @mysql_query("SELECT horse_name, breed, horse_id FROM horses WHERE player_id='$player_id' AND age>3 AND age<=20 ORDER BY horse_name ASC")or die("Cannot find horses! " . mysql_error()); while($row = @mysql_fetch_array($result)): $horse_id = $row['horse_id']; $horse_name = stripslashes($row['horse_name']); $breed = $row['breed']; echo "$horse_name (#$horse_id), $breed\n"; $prev_species = $species; endwhile; if(!$horse_id){echo "No eligible horses!";}

echo "
  

Entrants: ";

$query = “SELECT h.horse_name, h.horse_id, h.breed FROM horses_entered he LEFT JOIN horses h ON he.horse_id=h.horse_id WHERE he.class_id=’$class_id’ ORDER BY h.horse_name ASC”;
$result = @mysql_query($query)or die(mysql_error());
while($row = @mysql_fetch_array($result)):
$name = $row[‘horse_name’];
$aid = $row[‘horse_id’];
$breed = $row[‘breed’];
$page = “horses.php”;
echo “$name (#$aid), $breed
\n”;
endwhile;
if(!$aid){echo “No entrants.”;}
echo "

";

include(‘footer.php’);
?>[/php]

How can I make this so that instead of a drop down select one by one and submit, I can submit all of the results with one click?

Sponsor our Newsletter | Privacy Policy | Terms of Service