Get the no of tracks required for a season,
Display a list of tracks from which the user selects the ones to include in the season,
Then display only the tracks selected for the user to add a round number and the date it should be held,
(All the above happens)
This should then be put into a mysql table
(This doesn't happen)
The print statements (put in to see whats happening) in case"Add Rounds": segment show
print_a(NULL)0
Wheream I doing wrong ?
Code: Select all
<?php
include "debuglib.php";
switch($_POST[action])
{
case "Select Circuits":
$selects = sizeof($rounds);
if ($selects == $norounds)
{
$i= 0;
$display_block = "<h1>Enter Round Number, Date for each circuit</h1>";
while ($i < $selects)
{
$get_list3 = "SELECT track_name from GPL_circuits WHERE id = $rounds[$i]";
$get_list3_res = mysql_query($get_list3) or die("Didn't get the track name");
$track_name = mysql_result($get_list3_res,0,track_name);
$display_block .="
<form method="post" action="$_SERVER[PHP_SELF]">";
$display_block .="Round Number
<INPUT type="text" name="$rounds[$i]['rid']" size=2>";
$display_block .="to be held at "$track_name" on
<INPUT type="text" name="$rounds[$i]['date']" size=10><br>";
$i++;
}
$display_block .="
<p><INPUT type="submit" name="action" value="Add Rounds"></p>
</form>";
}
else
{
print"Incorrect Number of tracks selected";
}
break;
case "Add Rounds":
$i= 0;
print_a($rounds);
print"$selects";
print"$i";
while ($i < $selects)
{
$make_link = "INSERT INTO GPL_schedule VALUES ('$cursid', '$sel_divid', '$rounds[$i], '$rounds[$i]['rid'], '$sel_tid[$i]['date']')";
$make_link_res = mysql_query($make_link) or die("Failed to add");
$i++;
}
break;
default:
$get_list = "select notracks from GPL_season WHERE id = $sel_sid";
$get_list_res = mysql_query($get_list) or die("Failed to get no of tracks");
$notracks = mysql_result($get_list_res,0,notracks);
$get_list2 = "select id, track_name from GPL_circuits";
$get_list2_res = mysql_query($get_list2) or die("Failed to load track names");
$selects = 0;
$display_block = "<h1>Select Circuits for Schedule</h1>";
$display_block .= "
<form method="post" action="$_SERVER[PHP_SELF]">
<input type="hidden" name="sel_divid" value="$sel_divid">";
while ($trackrecs = mysql_fetch_array($get_list2_res))
{
$id = $trackrecs[id];
$track_name = stripslashes($trackrecs[track_name]);
$display_block .= "
<input type="hidden" name="norounds" value="$notracks">
<input type="checkbox" name="rounds[]" value="$id">$track_name";
}
$display_block .= "
<p><INPUT type="submit" name="action" value="Select Circuits"></p>
</form>";
break;
}
?>