Jump to content

Losing Array Value


smproph

Recommended Posts

I seem to be losing my array value when it comes to the "Game Time" section of my script. I am printing out the array a long the entire time and this is where I lose it and can't figure out why.

<form name="form1" method="post" action="">
<span class="whitetitle">How many teams?</span>
	<ul class="pageitem">
            <li>
				<SELECT name="teams"  onchange="document.form1.submit();">
            		<option value="1">1</option>
                   <option value="2">2</option>
                   <option value="3">3</option>
                   <option value="4">4</option>
                   <option value="5">5</option>
                   <option value="6">6</option>
                   <option value="7">7</option>
                   <option value="8">8</option> 
                   <option value="9">9</option>
                   <option value="10">10</option>
                   <option value="11">11</option>
                   <option value="12">12</option>
            	</SELECT>
                </li>
                </ul>
                </form>
        <?
if($_POST['teams'])
{
?>
<form  method="post" name="form2" action="">
<span class="whitetitle">Team Name</span>
<?php
$teams=$_POST['teams'];
$count=0;
  while($count<$teams)
  {
  ?>
	<ul class="pageitem">
		<li class="bigfield">
            <input placeholder="Name" type="text" name="teamname[]"/>
            </li>
           </ul>
         <?
	 $count++;
	 }
	 ?> 
         <input type="hidden" value="<?=$teams?>" name="teams" />
          <input type="submit" name="Submit" value="Next"> 
</form>    
<?
}
?>
        <?
	if ($_POST['teamname'])
	{
		$teams=$_POST['teams'];
		$teamname=$_POST['teamname'];
	?>
        <form name="form" method="post" action="">
          <span class="name"><? print_r ($_POST['teamname']);?></span>
      	<ul class="pageitem">
		<li class="radiobutton"><span class="name">Season</span>
		<input name="schedule" type="radio" value="season" onClick="this.form.action='';this.form.submit()" /></li>
		<li class="radiobutton"><span class="name">Playoffs</span>
		<input name="schedule" type="radio" value="playoffs" onClick="this.form.action='';this.form.submit()"/></li>
	</ul>
        <input type="hidden" value="<?=$teams?>" name="teams" />
        <input type="hidden" value="<?=$teamname?>" name="teamname" />
        </form>
        <?
	}
	if($_POST['schedule'])
	{
		$teams=$_POST['teams'];
		$schedule=$_POST['schedule'];
		$teamname=$_POST['teamname'];
	?>
        <form name="form4" method="post" action="">
         <span class="name"><? print_r ($_POST['teamname']);?></span>
        <span class="whitetitle">Games per Night</span>
	<ul class="pageitem">
            <li>
				<SELECT name="games" onchange="document.form4.submit();">
            		<option value="1">1</option>
                   <option value="2">2</option>
                   <option value="3">3</option>
                   <option value="4">4</option>
                   <option value="5">5</option>
                   <option value="6">6</option>
                   <option value="7">7</option>
                   <option value="8">8</option> 
                   <option value="9">9</option>
                   <option value="10">10</option>
                   <option value="11">11</option>
                   <option value="12">12</option>
            	</SELECT>
                </li>
                </ul>
                <input type="hidden" value="<?=$teamname?>" name="teamname" />
                <input type="hidden" value="<?=$teams?>" name="teams" />
                <input type="hidden" value="<?=$schedule?>" name="schedule" />
                </form>
             <?
	}
	if($_POST['games'])
	{
		$teams=$_POST['teams'];
		$schedule=$_POST['schedule'];
		$games=$_POST['games'];
		$teamname=$_POST['teamname'];
		$count=0;
		 ?>
                <form name="form5" method="post" action="">
                  <span class="name"><? print_r ($_POST['teamname']);?></span>
             <span class="whitetitle">Times</span>
	<ul class="pageitem">
        <?
	while($count<$games)
	{
	?>
            <li>
			<input placeholder="Times" type="text" name="times[]"/>
                </li>
          <?
	  $count++;
	}
	  ?>
                </ul>
                 <input type="hidden" value="<?=$teamname?>" name="teamname" />
                 <input type="hidden" value="<?=$teams?>" name="teams" />
                <input type="hidden" value="<?=$schedule?>" name="schedule" />
                <input type="hidden" value="<?=$games?>" name="games" />
                <input type="submit" name="Submit" value="Next">
			</form>
<?
	}
	if($_POST['times'])
	{

		echo $_POST['teams'];
		print_r ($_POST['teamname']);
		echo $_POST['schedule'];
		echo $_POST['games'];
		echo implode(",",$_POST['times']);
	}
?>

 

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.