lotpb 0 Newbie Poster

I cant get the List/menu to remember the list choice when i reload the form

<script type="text/javascript">

function reload(form)
{

var val=form.SelectDate.options[form.SelectDate.options.selectedIndex].value ;
self.location='Snapshot.php?SelectDate=' + val ; 

<?php	
 		
$SelectDate=$_GET['SelectDate'];
switch($SelectDate)
{
        case "1" :
                $Datefrom = date('Y-01-01');
				$Dateto = date('Y-12-31');
				$aa ="selected";
                break;
        case "2" :
                $Datefrom = date('Y-01-01');
				$Dateto = date('Y-m-d');
				$bb ="selected";
                break;
        case "3" :
                $Datefrom = date("Y-m-d",strtotime("-1 days"));
				$Dateto = date("Y-m-d",strtotime("-1 days"));
                break;
		case "4" :
                $Datefrom = date('Y-m-d',strtotime(date('Y')."W".date('W')."0"));
				$Dateto = date('Y-m-d',strtotime(date('Y')."W".date('W')."7"));
                break;
        case "5" :
                $Datefrom = date('Y-m-d',strtotime(date('Y')."W".date('W')."0"));
				$Dateto = date('Y-m-d');
                break;
        case "6" :
                $Datefrom = date("Y-m-01",strtotime("-1 month"));
				$Dateto = date("Y-m-t",strtotime("-1 month"));
                break;
	    case "7" :
                $Datefrom = date("Y-m-01",strtotime("-1 month"));
				$Dateto = date("Y-m-d",strtotime("-1 month"));
                break;
        case "8" :
                $Datefrom = date("Y-01-01",strtotime("-1 year"));
				$Dateto = date("Y-12-31",strtotime("-1 year"));
				$aa ="selected";
                break;
        case "9" :
                $Datefrom = date("Y-01-01",strtotime("-1 year"));
				$Dateto = date("Y-m-d",strtotime("-1 year"));
                break;
		case "10" :
                $Datefrom = date('Y-m-d');
				$Dateto = date('Y-m-d');
                break;
        case "11" :
                $Datefrom = date("Y-m-01");
				$Dateto = date("Y-m-t");
                break;
        case "12" :
                
                break;		
        case "13" :
               
                break;
        case "14" :
                $Datefrom = date('1980-01-01');
				$Dateto = date('Y-12-31');
                break;						
}

?>
    <form action="Snapshot.php" method="get" name="form3" id="form3">
      <select name='SelctDate' id="SelectDate" onchange="reload(this.form)"> <!--submit();--> 
        <option value='1'>Current Year</option>
        <option value='2'>Current Year-to-date</option>
        <option value='3'>Yesterday</option>
        <option value='4'>Last Week</option>
        <option value="5">Last Week-to-date</option>
        <option value="6">Last Month</option>
        <option value="7">Last Month-to-date</option>
        <option value="8">Last Year</option>
        <option value="9">Last Year-to-date</option>
        <option value="10">Today</option>
        <option value="11">Current Month</option>
        <option value="12">Current Quarter</option>
        <option value="13">Current Quarter-to-date</option>
        <option value="14">All Dates</option>
      </select>
      from
      <input name="Datefrom" type="text" id="Datefrom" value="<?php echo $Datefrom ?>" size="10" />
      to
      <input name="Dateto" type="text" id="Dateto" value="<?php echo $Dateto ?>" size="10" />
      <input type="submit" name="button2" id="button2" value="New date" />

    </form>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.