Expand|Select|Wrap|Line Numbers
- <?php
- // Get the posted data, if any, or initialize as null or today's date
- ($type = @$_POST['Type']) or $type = 1;
- ($item = @$_POST['Item']) or $item = 1;
- ($name = @$_POST['name']) or $name = "all";
- ($firstdate = @$_POST['firstdate']) or $firstdate=date("ymd");
- ($lastdate = @$_POST['lastdate']) or $lastdate = date("ymd");
- ($userchoice = @$_POST['userchoice']) or $userchoice = "no";
- ($hourchoice = @$_POST['hourchoice']) or $hourchoice = "no";
- ($ratechoice = @$_POST['ratechoice']) or $ratechoice = "no";
- ($amountchoice = @$_POST['amountchoice']) or $amountchoice = "no";
- ($commentchoice= @$_POST['commentchoice']) or $commentchoice = "no";
- $choices=array('no','yes');
- // Open the form element
- echo '<form action="" method="post"> ';
- echo '<p>User(Type username or all): <input type="text" name="name" value="', htmlentities($name),'"/><br//></p>';
- echo '<p>Start of Period (yymmdd): <input type="text" name="firstdate" value="', htmlentities($firstdate),'"/><br//></p>';
- echo '<p>End of Period(yymmdd): <input type="text" name="lastdate" value="', htmlentities($lastdate),'"/><br//></p>';
- // Print first select
- echo '<select name="Type" onchange="submit();">';
- echo '<option value="">- All projects -</option>';
- foreach(array_keys($items) as $_type) {
- // Check if this type was selected last submit
- $selected = ($type == $_type ? 'selected="selected"' : '');
- // Print this type as an option
- echo '<option value="'. $_type .'" '. $selected .'>'. $_type .'</option>';
- }
- echo '</select>';
- // Print the second select
- echo '<select name="Item[]" multiple="multiple">';
- echo '<option value="">- All phases -</option>';
- if($type) {
- foreach($items[$type] as $_item) {
- // Check if this item was selected last submit
- $selected = ($item == $_item ? 'selected="selected"' : '');
- // Print this item as an option
- echo '<option value="'. $_item .'" '. $selected .'>'. $_item .'</option>';
- }
- }
- echo '</select>';
- echo "<br><br>";
- echo 'Display Users ';
- echo '<select name="userchoice" onchange="submit();">';
- foreach($choices as $key=>$_selection) {
- // Check if this type was selected last submit
- $selected = ($userchoice == $_selection ? 'selected="selected"' : '');
- // Print this type as an option
- echo '<option value="'. $_selection .'" '. $selected .'>'. $_selection .'</option>';
- }
- echo '</select>';
- echo '<br>';
- echo '<br>';
- echo 'Display Hours ';
- echo '<select name="hourchoice" onchange="submit();">';
- foreach($choices as $key=>$_selection) {
- // Check if this type was selected last submit
- $selected = ($hourchoice == $_selection ? 'selected="selected"' : '');
- // Print this type as an option
- echo '<option value="'. $_selection .'" '. $selected .'>'. $_selection .'</option>';
- }
- echo '</select>';
- echo '<br>';
- echo '<br>';
- echo '</form>';
- echo '<form action="test.php" method="post"> ';
- echo'<p><input type="submit" value="Selections"/></p>';
- echo '</form>';
- ?>