<?php // header("Location: http://www.jkwebdesigns.com/eg/index.php"); ?>
<?php include ("_website_init.php"); 
?>
<?php // load records from 'books'
  list($booksRecords, $booksMetaData) = getRecords(array(
    'tableName'   => 'books',
    'loadUploads' => true,
    'allowSearch' => true,

  ));
  
  // load records from 'faq'
   list($faqRecords, $faqMetaData) = getRecords(array(
    'tableName'   => 'faq',
    'loadUploads' => true,
    'allowSearch' => false,

  ));
  
 // load records from 'navigation_menu'
  list($navigation_menuRecords, $navigation_menuMetaData) = getRecords(array(
    'tableName'   => 'navigation_menu',
    'loadUploads' => true,
    'allowSearch' => false,
  ));
  
  // error checking
   $errorsAndAlerts = '';
   if (@$_REQUEST['save']) 
  { 
 
   $action = '' ;
   
  }
?>
<?php if ($common_informationRecord['login_required'] == 1):?>
<?php if (!$CURRENT_USER) { websiteLogin_redirectToLogin(); } ?>
<?php endif?>
<?php if (@$_REQUEST['pdf']==1) { createPDF_fromOutput('inline', 'popup.pdf'); } ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ERIC GREENBERG'S POP UP BOOKS SPREAD SHEET</title>
<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" type="image/ico" href="http://www.jkwebdesigns.com/favicon.ico" />
<link href="http://www.jkwebdesigns.com/eg/css/eg.css.php" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="http://www.jkwebdesigns.com/eg/css/fonts.css.php" />
<?php include ("_preload.php"); ?>
<link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=<?php 
    $output = ''; 
    foreach ($google_font_namesRecords as $record) { $record['name'] = preg_replace("/[, ]/", "+", $record['name']);
      $output .= $record['name'] . "|"; 
    } 
    $output = rtrim($output,"|"); // remove trailing pipe 
    print $output; 
?>">
<style type="text/css">
input[type=submit] {
	font-weight: bold;
}
</style>
<script type="text/javascript">
jQuery("#zip").click(function() {
  alert( "Handler for .click() called." );
});</script>
</head>
<body >
<p>&nbsp;</p>
<table class="shadow3" bgcolor="#<?php echo $eg_colorsRecord['main_box_background_color'] ?>" width="55%" border="0" align="center" cellpadding="0">
  <tr>
    <td  colspan="2" bgcolor="#<?php echo $eg_colorsRecord['masthead_background_color'] ?>"><div class="under round-corner" align="left">
        <?php foreach ($common_informationRecord['masthead'] as $index => $upload): ?>
        <img src="http://www.jkwebdesigns.com<?php echo $upload['thumbUrlPath3'] ?>"   alt="EG Masthead" />
        <?php endforeach ?>
      </div></td>
  </tr>
  <tr>
    <td class="shadow3"  width="20%" rowspan="4" align="right" valign="top" bgcolor="#<?php echo $eg_colorsRecord['menu_background_color'] ?>" ><?php include ("_mainnavmenu.php"); ?></td>
    <td width="82%"></td>
  </tr>
  <tr>
    <td align="center" ><br />
      <br />
      <div align="center" style="width:80%; text-align:left"> 
        <!-- Insert Active Code Here --> 
        <br />
        <div align="center" style="width:80%; " class="heading_font"><?php echo $common_informationRecord['home_page_head'] ?></div>
        <br />
        <div align="center" class="text_font" style="width:80%; text-align:left"><?php echo $common_informationRecord['home_page_text'];?></div>
        <br />
        <hr  align="left" style="height:2px; background-color:#<?php echo $eg_colorsRecord['menu_background_color'] ?>;" width="90%" color="#<?php echo $eg_colorsRecord['menu_background_color'] ?>"/>
        <br />
        <?php if(@$errorsAndAlerts):?>
        <table align="left" width="90%" border="0" cellspacing="0" cellpadding="2">
          <tr>
            <td align="left"  colspan="2"><span class="heading_font" style="color: #C00;"><?php echo @$errorsAndAlerts ?></span></td>
          </tr>
        </table>
        <?php endif ?>
        <?php if  (!@$_REQUEST['save'] == 1 || @$errorsAndAlerts):
		    ?>
        <table align="left" width="90%" border="0" cellspacing="0" cellpadding="2">
          <tr>
            <td colspan="2"><span class="heading_font"><b>SEARCH BOOKS - SPREAD SHEET REPORT</b><br />
              </span></td>
          </tr>
          <tr>
            <td align="left"  colspan="2"><span class=" sub_heading_font">Select the fields that you want to show in the report. <br />Use any of the pull down fields below to narrow your search. Use only those criteria most important to you.</span> <br />
              <span class="text_font"><br />
              You can always change your search criteria and re-submit. <br />
              <br />
              <b>Hint:</b> to select more than one option for any of the fields below, hold the CTRL (CMD) key and click to highlight each of the options.<br />
              </span><!-- <br />
            <font color="#FF0000">*</font> = Required Field <br />
            <br />--></td>
          </tr>
          <?php if(@$errorsAndAlerts):?>
          <tr>
            <td align="left"  colspan="2"><span class="heading_font" style="color: #C00;"><?php echo @$errorsAndAlerts ?></span></td>
          </tr>
          <?php endif ?>
        </table>
        <br />
        <br />
        <form method="post"  action= "spread7.php">
          <input type="hidden" name="save" value="1" />
          <table align="left" width="90%" border="0" cellspacing="0" cellpadding="2">
            <tr>
              <td colspan="2">&nbsp;</td>
            </tr>
            <tr>
              <td  align="right" class="text_font"><b>Title</b><br /></td>
              <td align="left" valign="bottom" colspan="2"><input type="text" name="title_query"  width="300" class="text_font" style="width: 300px; max-height: 50px; background-color:#<?php echo $eg_colorsRecord['main_box_background_color'] ?>;" placeholder="Optional- Partials OK" value="<?php echo htmlencode(@$_REQUEST['title_query']); ?>"  ></td>
            </tr>
            <tr>
              <td  align="right" class="text_font"><b>Genre 1:</b><br /></td>
              <td align="left" valign="bottom" colspan="2"><select name = "genre_match[]"  width="300" class="text_font" style="width: 300px; max-height: 50px; background-color:#<?php echo $eg_colorsRecord['main_box_background_color'] ?>;"  multiple>
                  <?php foreach (getListOptions('books', 'genre') as $value => $label7): ?>
                  <option value = "<?php echo $value;?>" <?php selectedIf($value, @$_REQUEST['genre']);?>> <?php echo $label7; ?></option>
                  <?php endforeach ?>
                </select>
                <br />
                <b class="text_font">Show 'Genre 1' field?</b>
                <input type="checkbox" name="genre_visible" ></td>
            </tr>
            <tr>
              <td  align="right" class="text_font"><b>Genre 2:</b><br /></td>
              <td align="left" valign="bottom" colspan="2"><select name = "genre_2_match[]"  width="300" class="text_font" style="width: 300px; max-height: 50px; background-color:#<?php echo $eg_colorsRecord['main_box_background_color'] ?>;"  multiple>
                  <?php foreach (getListOptions('books', 'genre_2') as $value => $label12): ?>
                  <option value = "<?php echo $value;?>" <?php selectedIf($value, @$_REQUEST['genre_2']);?>> <?php echo $label12; ?></option>
                  <?php endforeach ?>
                </select>
                <br />
                <b class="text_font">Show 'genre 2 field?</b>
                <input type="checkbox" name="genre_2_visible" ></td>
            </tr>
            <tr>
              <td  align="right" class="text_font"><b>Book Location:</b><br /></td>
              <td align="left" valign="bottom" colspan="2"><select name = "location_match[]"  width="300" class="text_font" style="width: 300px; max-height: 50px; background-color:#<?php echo $eg_colorsRecord['main_box_background_color'] ?>;"  multiple>
                  <?php foreach (getListOptions('books', 'location') as $value => $label8): ?>
                  <option value = "<?php echo $value;?>" <?php selectedIf($value, @$_REQUEST['location']);?>> <?php echo $label8; ?></option>
                  <?php endforeach ?>
                </select>
                <br />
                <b class="text_font">Show 'Location' field?</b>
                <input type="checkbox" name="location_visible" ></td>
            </tr>
            <tr>
              <td  align="right" class="text_font"><b>Writer(s)</b><br /></td>
              <td align="left" valign="bottom" colspan="2"><input type="text" name="writer_1,writer_2_query"  width="300" class="text_font" style="width: 300px; max-height: 50px; background-color:#<?php echo $eg_colorsRecord['main_box_background_color'] ?>;" placeholder="Optional- Partials OK" value="<?php echo htmlencode(@$_REQUEST['writer_1,writer_2_query']); ?>"  >
                <br />
                <b class="text_font">Show 'Writers' field?</b>
                <input type="checkbox" name="writers_visible" ></td>
            </tr>
            <tr>
              <td  align="right" class="text_font"><b>Illustrator(s)</b><br /></td>
              <td align="left" valign="bottom" colspan="2"><input type="text" name="illustrator_1,illustrator_2_query"  width="300" class="text_font" style="width: 300px; max-height: 50px; background-color:#<?php echo $eg_colorsRecord['main_box_background_color'] ?>;" placeholder="Optional- Partials OK" value="<?php echo htmlencode(@$_REQUEST['illustrator_1,illustrator_2_query']); ?>"  >
                <br />
                <b class="text_font">Show 'Illustrators' field?</b>
                <input type="checkbox" name="illustrators_visible" ></td>
            </tr>
            <tr>
              <td  align="right" class="text_font"><b>Paper Engineer(s)</b><br /></td>
              <td align="left" valign="bottom" colspan="2"><input type="text" name="paper_engineer_1,paper_engineer_2,paper_engineer_3_query"  width="300" class="text_font" style="width: 300px; max-height: 50px; background-color:#<?php echo $eg_colorsRecord['main_box_background_color'] ?>;" placeholder="Optional- Partials OK" value="<?php echo htmlencode(@$_REQUEST['paper_engineer_1,paper_engineer_2,paper_engineer_3_query']); ?>"  >
                <br />
                <b class="text_font">Show 'Paper Engineers' field?</b>
                <input type="checkbox" name="paper_engineers_visible" ></td>
            </tr>
            <tr>
              <td  align="right" class="text_font"><b>Publisher</b><br /></td>
              <td align="left" valign="bottom" colspan="2"><input type="text" name="publisher_query"  width="300" class="text_font" style="width: 300px; max-height: 50px; background-color:#<?php echo $eg_colorsRecord['main_box_background_color'] ?>;" placeholder="Optional- Partials OK" value="<?php echo htmlencode(@$_REQUEST['publisher_query']); ?>"  >
                <br />
                <b class="text_font">Show 'Publisher' field?</b>
                <input type="checkbox" name="publisher_visible" ></td>
            </tr>
            <tr>
              <td  align="right" class="text_font"><b>Publication Date</b><br /></td>
              <td align="left" valign="bottom" colspan="2"><input type="text" name="publication_date_query"  width="300" class="text_font" style="width: 300px; max-height: 50px; background-color:#<?php echo $eg_colorsRecord['main_box_background_color'] ?>;" placeholder="Optional- Partials OK" value="<?php echo htmlencode(@$_REQUEST['publication_date_query']); ?>"  >
                <br />
                <b class="text_font">Show 'Publication Date' field?</b>
                <input type="checkbox" name="publication_date_visible" ></td>
            </tr>
            <tr>
              <td  align="right" class="text_font"><b>Quality:</b><br /></td>
              <td align="left" valign="bottom" colspan="2"><select name = "quality_match[]"  width="300" class="text_font" style="width: 300px; max-height: 50px; background-color:#<?php echo $eg_colorsRecord['main_box_background_color'] ?>;"  multiple>
                  <?php foreach (getListOptions('books', 'quality') as $value => $label9): ?>
                  <option value = "<?php echo $value;?>" <?php selectedIf($value, @$_REQUEST['quality']);?>> <?php echo $label9; ?></option>
                  <?php endforeach ?>
                </select>
                <br />
                <b class="text_font">Show 'Quality' field?</b>
                <input type="checkbox" name="quality_visible" ></td>
            </tr>
            <tr>
              <td align="right" class="text_font"><b>Get Better Copy: </b></td>
              <td align="left" valign="bottom" colspan="2"><select name = "get_better_copy" width="300" class="text_font" style="width: 300px; background-color:#<?php echo $eg_colorsRecord['main_box_background_color'] ?>;">
                  <option value="">Optional</option>
                  <option value="1">Yes</option>
                </select>
                <br />
                <b class="text_font">Show 'Get Better Copy' field?</b>
                <input type="checkbox" name="get_better_copy_visible" ></td>
            </tr>
            <tr>
              <td  align="right" class="text_font"><b>Purchased From</b><br /></td>
              <td align="left" valign="bottom" colspan="2"><input type="text" name="purchased_from_query"  width="300" class="text_font" style="width: 300px; max-height: 50px; background-color:#<?php echo $eg_colorsRecord['main_box_background_color'] ?>;" placeholder="Optional- Partials OK" value="<?php echo htmlencode(@$_REQUEST['purchased_from_query']); ?>"  >
                <br />
                <b class="text_font">Show 'Purchased From' field?</b>
                <input type="checkbox" name="purchased_from_visible" ></td>
            </tr>
            <tr>
              <td  align="right" class="text_font"><b>Purchased Date</b><br /></td>
              <td align="left" valign="bottom" colspan="2"><input type="text" name="purchase_date_query"  width="300" class="text_font" style="width: 300px; max-height: 50px; background-color:#<?php echo $eg_colorsRecord['main_box_background_color'] ?>;" placeholder="Optional- Partials OK" value="<?php echo htmlencode(@$_REQUEST['purchase _date_query']); ?>"  >
                <br />
                <b class="text_font">Show 'Purchase Date' field?</b>
                <input type="checkbox" name="purchase_date_visible" ></td>
            </tr>
            <tr>
              <td  align="right" class="text_font"><b>Purchase Price</b><br /></td>
              <td align="left" valign="bottom" colspan="2"><input type="text" name="purchase_price_query"  width="300" class="text_font" style="width: 300px; max-height: 50px; background-color:#<?php echo $eg_colorsRecord['main_box_background_color'] ?>;" placeholder="Optional- Partials OK" value="<?php echo htmlencode(@$_REQUEST['purchase_price_query']); ?>"  >
                <br />
                <b class="text_font">Show 'Purchase Price' field?</b>
                <input type="checkbox" name="purchase_price_visible" ></td>
            </tr>
            <tr>
              <td  align="right" class="text_font"><b>Sold To</b><br /></td>
              <td align="left" valign="bottom" colspan="2"><input type="text" name="sold_to_query"  width="300" class="text_font" style="width: 300px; max-height: 50px; background-color:#<?php echo $eg_colorsRecord['main_box_background_color'] ?>;" placeholder="Optional- Partials OK" value="<?php echo htmlencode(@$_REQUEST['sold_to_query']); ?>"  >
                <br />
                <b class="text_font">Show 'Sold To' field?</b>
                <input type="checkbox" name="sold_to_visible" ></td>
            </tr>
            <tr>
              <td  align="right" class="text_font"><b>Sale Date</b><br /></td>
              <td align="left" valign="bottom" colspan="2"><input type="text" name="sale_date_query"  width="300" class="text_font" style="width: 300px; max-height: 50px; background-color:#<?php echo $eg_colorsRecord['main_box_background_color'] ?>;" placeholder="Optional- Partials OK" value="<?php echo htmlencode(@$_REQUEST['sale_date_query']); ?>"  >
                <br />
                <b class="text_font">Show 'Sale Date' field?</b>
                <input type="checkbox" name="sale_date_visible" ></td>
            </tr>
            <tr>
              <td  align="right" class="text_font"><b>Sale Price</b><br /></td>
              <td align="left" valign="bottom" colspan="2"><input type="text" name="sale_price_query"  width="300" class="text_font" style="width: 300px; max-height: 50px; background-color:#<?php echo $eg_colorsRecord['main_box_background_color'] ?>;" placeholder="Optional- Partials OK" value="<?php echo htmlencode(@$_REQUEST['sale_price_query']); ?>"  >
                <br />
                <b class="text_font">Show 'Sale Price' field?</b>
                <input type="checkbox" name="sale_price_visible" ></td>
            </tr>
            <tr> <td  align="right" class="text_font">&nbsp;<br /></td><td align="left" valign="bottom" colspan="2"> 
                <br />
               <b class="text_font">Show 'Comments' field?</b>
                <input type="checkbox" name="comments_visible" >
                <br />
                <b class="text_font">Show 'ISBN'?</b>
                <input type="checkbox" name="isbn_visible" >
                 <br />
               <b class="text_font">Show 'Special Information' field?</b>
                <input type="checkbox" name="special_information_visible" ><br /><br /></td></tr> 
            <tr>
              <td align="right" class="text_font"><b>&nbsp;</b></td>
              <td align="left" valign="bottom" colspan="2"><input type="submit" value="Submit Search Filters" ></td>
            </tr>
          </table>
        </form>
        <?php endif ?>
        <table align="left" width="90%" border="0" cellspacing="0" cellpadding="2">
          <tr> 
            <!--<td>&nbsp;</td>-->
            <td align="center" colspan="2"><form method="post" action="" >
                <INPUT TYPE="submit" VALUE="Cancel Search Filters - Start Another Search">
              </form></td>
          </tr>
          <!-- </table>--><br />
          <!-- <table align="left" width="90%" border="0" cellspacing="0" cellpadding="2"> --> 
          <!-- BEGIN RESULTS DISPLAY-->
          
          <tr>
            <td colspan="2"><?php
		
		  // Start Genre 1
		  @$genresearchCriteria = "";  // set default value
		  if  ((@$_REQUEST['save'] == 1) && @$_REQUEST['genre_match']) {
		   @$genresearchCriteria = "<b>Genre 1: </b>";  // set default value 
		   // cycle through each genre selected
		   foreach ($_REQUEST['genre_match'] as $genre) {
			 
			 // lookup genre number in database
			 $genreRecord = mysql_get("genre_categories", $genre);
			 
			 if ($genreRecord) {
			   // add "genre" value to output
			   @$genresearchCriteria .= $genreRecord['genre_names'] .", ";
			 }
		   }
		  }
		  // End Genre 1
		  
		   // Start Genre 2
		  @$genre_2Criteria = "";  // set default value
		  if  ((@$_REQUEST['save'] == 1) && @$_REQUEST['genre_2_match']) {
		   @$genre_2searchCriteria = "<b>Genre 2: </b>";  // set default value 
		   // cycle through each genre 2 selected
		   foreach ($_REQUEST['genre_2_match'] as $genre_2) {
			 
			 // lookup Genre 2 number in database
			 $genre_2Record = mysql_get("genre_categories", $genre_2);
			 
			 if ($genre_2Record) {
			   // add "genre 2" value to output
			   @$genre_2searchCriteria .= $genre_2Record['genre_names'] .", ";
			 }
		   }
		  }
		  // End Genre 2
		   
		   // Start Book Location
		  @$locationsearchCriteria = "";  // set default value
		  if  ((@$_REQUEST['save'] == 1) && @$_REQUEST['location_match']) {
		   @$locationsearchCriteria = "<b>Location: </b>";  // set default value 
		   // cycle through each location selected
		   foreach ($_REQUEST['location_match'] as $location) {
			 
			 // lookup location number in database
			 $locationRecord = mysql_get("book_location", $location);
			 
			 if ($locationRecord) {
			   // add "location" value to output
			   @$locationsearchCriteria .= $locationRecord['shelf_location'] .", ";
			 }
		   }
		  }
		  // End Book Location
		  
		  	   // Start Quality
		  @$qualitysearchCriteria = "";  // set default value
		  if  ((@$_REQUEST['save'] == 1) && @$_REQUEST['quality_keyword']) {
		   @$qualitysearchCriteria = "<b>Quality: </b>";  // set default value 
		   // cycle through each quality selected
		   foreach ($_REQUEST['quality_keyword'] as $quality_values) {
			 
			 // lookup quality number in database
			 $qualityRecord = mysql_get("quality_categories", $quality_values);
			 
			 if ($qualityRecord) {
			   // add "quality" value to output
			   @$qualitysearchCriteria .= $qualityRecord['quality_values'] .", ";
			 }
		   }
		  }
		  // End Quality
		 
		  
		 
    if ((@$_REQUEST['save'] == 1) && @$_REQUEST['get_better_copy'] && @$_REQUEST['get_better_copy'] == 1) { @$bettercopysearchCriteria .= "<b>Look For A Better Copy:</b> Yes"; }
	//  if ((@$_REQUEST['save'] == 1) && @$_REQUEST['get_better_copy'] && (@$_REQUEST['get_better_copy'] == 0 || @$_REQUEST['get_better_copy'] == "")) { @$bettercopysearchCriteria .= "<b>Look For A Better Copy:</b> No"; }
		  
		  @$locationsearchCriteria = chop(@$locationsearchCriteria, ', '); // remove trailing , or spaces
		 @$locationsearchCriteria = chop(@$locationsearchCriteria, '- '); // remove trailing - or spaces
		 
		  @$genresearchCriteria = chop(@$genresearchCriteria, ', '); // remove trailing , or spaces
		 @$genresearchCriteria = chop(@$genresearchCriteria, '- '); // remove trailing - or spaces
		 
		  @$qualitysearchCriteria = chop(@$qualitysearchCriteria, ', '); // remove trailing , or spaces
		 @$qualitysearchCriteria = chop(@$qualitysearchCriteria, '- '); // remove trailing - or spaces
		 
		  @$bettercopysearchCriteria = chop(@$bettercopysearchCriteria, ', '); // remove trailing , or spaces
		 @$bettercopysearchCriteria = chop(@$bettercopysearchCriteria, '- '); // remove trailing - or spaces
			 
		?>
              <?php @$searchCriteria = '';?>
              <?php @$searchCriteria2 = '';?>
              <?php @$searchCriteria3 = '';?>
              <?php @$searchCriteria4 = '';?>
              <?php @$searchCriteria5 = '';?>
              <?php @$searchCriteria6 = '';?>
              <?php @$searchCriteria7 = '';?>
              <?php @$searchCriteria8 = '';?>
              <?php @$searchCriteria9 = '';?>
              <?php @$searchCriteria10 = '';?>
              <?php @$searchCriteria11 = '';?>
              <?php @$searchCriteria12 = '';?></td>
          </tr>
          <tr>
            <td colspan="2"><div align="left"> <span class="text_font">
                <?php if (!$errorsAndAlerts) :?>
                <?php $count = '' ?>
                <?php if(@$_REQUEST['save']):?>
                <hr  align="left" style="height:2px; background-color:#<?php echo $eg_colorsRecord['menu_background_color'] ?>;" width="90%" color="#<?php echo $eg_colorsRecord['menu_background_color'] ?>"/>
                <?php if($booksMetaData['totalRecords'] == 0 ||$booksMetaData['totalRecords'] >= 2):?>
                There are
                <?php elseif($booksMetaData['totalRecords'] == 1):?>
                There is
                <?php endif ?>
                <?php echo $booksMetaData['totalRecords']; ?>
                <?php if($booksMetaData['totalRecords'] == 0 ||$booksMetaData['totalRecords'] >= 2):?>
                listings
                <?php elseif($booksMetaData['totalRecords'] == 1):?>
                listing
                <?php endif ?>
                that
                <?php if($booksMetaData['totalRecords'] == 0 ||$booksMetaData['totalRecords'] >= 2):?>
                match
                <?php elseif($booksMetaData['totalRecords'] == 1):?>
                matches
                <?php endif ?>
                your search for:
                <?php if (@$locationsearchCriteria || @$genresearchCriteria || @$genre_2searchCriteria || @$qualitysearchCriteria ||  @$bettercopysearchCriteria || @$searchCriteria || @$searchCriteria2 || @$searchCriteria3 || @$searchCriteria4 || @$searchCriteria5 || @$searchCriteria6 || @$searchCriteria7|| @$searchCriteria || @$searchCriteria8 || @$searchCriteria9 || @$searchCriteria10 || @$searchCriteria11 || @$searchCriteria12 ): // add searchable field variables here?>
                <br />
                <?php echo @$locationsearchCriteria ?> <br />
                <?php echo @$genresearchCriteria ?> <br />
                <?php echo @$genre_2searchCriteria ?> <br />
                <?php echo @$qualitysearchCriteria ?><br />
                <?php echo @$bettercopysearchCriteria ?>
                <?php else :?>
                All Listings
                <?php  endif ?>
                <?php if (@$_REQUEST['title_query']) { $searchCriteria .= "and with a <b>Title</b> including: {$_REQUEST['title_query']}"; } ?>
                <?php if (  @!$searchCriteria ==''):?>
                <?php echo @$searchCriteria ?>
                <?php endif?>
                <?php if (@$_REQUEST['writer_1,writer_2_query']) {@$searchCriteria2 .= "and with a <b>Writer's Name</b> including: {$_REQUEST['writer_1,writer_2_query']}"; } ?>
                <?php if (  @!$searchCriteria2 ==''):?>
                <?php echo @$searchCriteria2 ?>
                <?php endif?>
                <?php if (@$_REQUEST['illustrator_1,illustrator_2_query']) {@$searchCriteria3 .= "and with an <b>Illustrator's Name</b> including: {$_REQUEST['illustrator_1,illustrator_2_query']}"; } ?>
                <?php if (  @!$searchCriteria3 ==''):?>
                <?php echo @$searchCriteria3 ?>
                <?php endif?>
                <?php if (@$_REQUEST['paper_engineer_1,paper_engineer_2,paper_engineer_3_query']) {@$searchCriteria4 .= "and with a <b>Paper Engineer's Name</b> including: {$_REQUEST['paper_engineer_1,paper_engineer_2,paper_engineer_3_query']}"; } ?>
                <?php if (  @!$searchCriteria4 ==''):?>
                <?php echo @$searchCriteria4 ?>
                <?php endif?>
                <?php if (@$_REQUEST['publisher_query']) {@$searchCriteria5 .= "and with a <b>Publisher's Name</b> including: {$_REQUEST['publisher_query']}"; } ?>
                <?php if (  @!$searchCriteria5 ==''):?>
                <?php echo @$searchCriteria5 ?>
                <?php endif?>
                <?php @$searchCriteria6 = '';?>
                <?php if (@$_REQUEST['publication_date_query']) {@$searchCriteria6 .= "and with a <b>Publication Date</b> including: {$_REQUEST['publication_date_query']}"; } ?>
                <?php if (  @!$searchCriteria6 ==''):?>
                <?php echo @$searchCriteria6 ?>
                <?php endif?>
                <?php if (@$_REQUEST['purchased_from_query']) {@$searchCriteria7 .= "and <b>Purchased From</b> including: {$_REQUEST['purchased_from_query']}"; } ?>
                <?php if (  @!$searchCriteria7 ==''):?>
                <?php echo @$searchCriteria7 ?>
                <?php endif?>
                <?php if (@$_REQUEST['purchase_date_query']) {@$searchCriteria11 .= "and with a <b>Purchase Date</b> including: {$_REQUEST['purchase_date_query']}"; } ?>
                <?php if (  @!$searchCriteria11 ==''):?>
                <?php echo @$searchCriteria11 ?>
                <?php endif?>
                <?php if (@$_REQUEST['purchaseprice']) {@$searchCriteria12 .= "and with a <b>Purchase Price</b> including: {$_REQUEST['purchase_price']}"; } ?>
                <?php if (  @!$searchCriteria12 ==''):?>
                <?php echo @$searchCriteria12 ?>
                <?php endif?>
                <?php if (@$_REQUEST['sold_to']) {@$searchCriteria7 .= "and <b>Sold To</b> including: {$_REQUEST['sold_to']}"; } ?>
                <?php if (  @!$searchCriteria8 ==''):?>
                <?php echo @$searchCriteria8 ?>
                <?php endif?>
                <?php if (@$_REQUEST['sale_date']) {@$searchCriteria10 .= "and with a <b>Sales Date</b> including: {$_REQUEST['sale_date']}"; } ?>
                <?php if (  @!$searchCriteria10 ==''):?>
                <?php echo @$searchCriteria10 ?>
                <?php endif?>
                <?php if (@$_REQUEST['sale_price']) {@$searchCriteria9 .= "and with a <b>Sales Price</b> including: {$_REQUEST['sale_price']}"; } ?>
                <?php if (  @!$searchCriteria9 ==''):?>
                <?php echo @$searchCriteria9 ?>
                <?php endif?>
                </span> </div>
              <?php endif ?></td>
          </tr>
          <tr>
            <td span class="text_font" colspan="2"><hr  align="left" style="height:2px; background-color:#<?php echo $eg_colorsRecord['menu_background_color'] ?>;" width="90%" color="#<?php echo $eg_colorsRecord['menu_background_color'] ?>"/>
              <?php endif ?>
              
              
              <br />
           
              <!--************************************
				Start Variables
		*************************************-->
              
              <?php if (isset($_POST['book_cover_image_visible'])) {
@$book_cover_image_visible = 1;
    
} else {

   @$book_cover_image_visible = 0;
}
?>
              <?php if (isset($_POST['location_visible'])) {
@$location_visible = 1;
    
} else {

   @$location_visible = 0;
}
?>
              <?php if (isset($_POST['publisher_visible'])) {
@$publisher_visible = 1;
    
} else {

   @$publisher_visible = 0;
}
?>
              <?php if (isset($_POST['publication_date_visible'])) {
@$publication_date_visible = 1;
    
} else {

   @$publication_date_visible = 0;
}
?>
              <?php if (isset($_POST['purchase_date_visible'])) {
@$purchase_date_visible = 1;
    
} else {

   @$purchase_date_visible = 0;
}
?>
              <?php if (isset($_POST['purchased_from_visible'])) {
@$purchased_from_visible = 1;
    
} else {

   @$purchased_from_visible = 0;
}
?>
              <?php if (isset($_POST['purchase_price_visible'])) {
@$purchase_price_visible = 1;
    
} else {

   @$purchase_price_visible = 0;
}
?>
              <?php if (isset($_POST['quality_visible'])) {
@$quality_visible = 1;
    
} else {

   @$quality_visible = 0;
}
?>
              <?php if (isset($_POST['get_better_copy_visible'])) {
@$get_better_copy_visible = 1;
    
} else {

   @$get_better_copy_visible = 0;
}
?>
              <?php if (isset($_POST['sale_date_visible'])) {
@$sale_date_visible = 1;
    
} else {

   @$sale_date_visible = 0;
}
?>
              <?php if (isset($_POST['sold_to_visible'])) {
@$sold_to_visible = 1;
    
} else {

   @$sold_to_visible = 0;
}
?>
              <?php if (isset($_POST['sale_price_visible'])) {
@$sale_price_visible = 1;
    
} else {

   @$sale_price_visible = 0;
}
?>
              <?php if (isset($_POST['genre_visible'])) {
@$genre_visible = 1;
    
} else {

   @$genre_visible = 0;
}
?>
              <?php if (isset($_POST['genre_2_visible'])) {
@$genre_2_visible = 1;
    
} else {

   @$genre_2_visible = 0;
}
?>
              <?php if (isset($_POST['comments_visible'])) {
@$comments_visible = 1;
    
} else {

   @$comments_visible = 0;
}
?>
              <?php if (isset($_POST['special_information_visible'])) {
@$special_information_visible = 1;
    
} else {

   @$special_information_visible = 0;
}
?>
              <?php if (isset($_POST['isbn_visible'])) {
@$isbn_visible = 1;
    
} else {

   @$isbn_visible = 0;
}
?>
              <?php if (isset($_POST['writers_visible'])) {
@$writers_visible = 1;
    
} else {

   @$writers_visible = 0;
}
?>
              <?php if (isset($_POST['illustrators_visible'])) {
@$illustrators_visible = 1;
    
} else {

   @$illustrators_visible = 0;
}
?>
              <?php if (isset($_POST['paper_engineers_visible'])) {
@$paper_engineers_visible = 1;
    
} else {

   @$paper_engineers_visible = 0;
}
?>
              <?php if (isset($_POST['youtube_links_visible'])) {
@$youtube_links_visible = 1;
    
} else {

   @$youtube_links_visible = 0;
}
?>
              
              <!--************************************
				Variables End
		*************************************--> 
     <!--************************************
				Header Row Start
		*************************************-->
       <?php @$var0 = 'Title'; @$var1=''; @$var2=''; @$var3=''; @$var4=''; @$var5=''; @$var6=''; @$var7=''; @$var8=''; @$var9=''; @$var10=''; @$var11=''; @$var12=''; @$var13=''; @$var14=''; @$var15=''; @$var16=''; @$var17=''; @$var18=''; @$var19='';  @$var20='';  @$var21='';  @$var22='';  @$var23='';?> 
              <?php  if(@$_REQUEST['save']):?>
              Title,
              <?php endif ?>
              <?php if(($location_visible == 1)):?>              
              <?php @$var1 = "Location" ?>
			  <?php echo  "Location," ?><?php endif ?>
              
              <?php if(($publisher_visible == 1)):?>
              <?php @$var2 = "Publisher" ?>
              <?php echo "Publisher," ?>
			  <?php endif ?>
              
              <?php if(($publication_date_visible == 1)):?>
              <?php @$var3 = "Publication Date" ?>
              <?php echo "Publication Date," ?>
			  <?php endif ?>
             
              <?php if(($purchase_date_visible == 1)):?>
              <?php $var4 = "Purchase Date" ?>
              <?php echo "Purchase Date," ?><?php endif ?>
              
			  <?php if(($purchased_from_visible == 1)):?>
              <?php @$var5 = "Purchased From" ?>
			  <?php echo "Purchased From," ?><?php endif ?>
              
			  <?php if(($purchase_price_visible == 1)):?>
              <?php @$var6 = "Purchase Price" ?>
			  <?php echo "Purchase Price," ?><?php endif ?>
			  
              <?php if(($quality_visible == 1)):?>
             <?php @$var7 = "Quality" ?>
			 <?php echo "Quality," ?>
			<?php endif ?>
			 
              <?php if(($get_better_copy_visible == 1)):?>
             <?php @$var8 = "Get Better Copy" ?>
			 <?php echo "Get Better Copy," ?>
			 <?php endif ?>
             
              <?php if(($sale_date_visible == 1) ):?>
              <?php @$var9 = "Sale Date" ?>
			  <?php echo "Sale Date," ?>
			  <?php endif ?>
              
			  <?php if(($sold_to_visible == 1)):?>
              <?php @$var10 = "Sold To" ?>
			  <?php echo "Sold To," ?><?php endif ?>
              
			  <?php if(($sale_price_visible == 1)):?>
              <?php @$var11 = "Sale Price" ?>
			  <?php echo "Sale Price," ?><?php endif ?>
             
              <?php if(($genre_visible == 1)):?>
              <?php @$var12 = "Genre 1" ?>
			  <?php echo "Genre 1," ?><?php endif ?>
              
			  <?php if(($genre_2_visible == 1)):?>
              <?php @$var13 = "Genre 2" ?>
			  <?php echo "Genre 2," ?><?php endif ?>
              
			  <?php  if(($comments_visible == 1)):?>
             <?php  @$var14 = "Comments" ?>
			 <?php  echo  "Comments," ?><?php  endif?>
             
              <?php  if(($special_information_visible == 1)):?>
              <?php  @$var15 = "Special Information" ?>
			  <?php  echo "Special Information," ?><?php  endif ?>
              
			  <?php  if(($isbn_visible == 1)):?>
              <?php  @$var16 = "ISBN" ?>
			  <?php  echo "ISBN," ?><?php  endif ?>
             
              <?php if($writers_visible == 1):?>
              <?php @$var17 = "Writer 1" ?>
              <?php @$var18 = "Writer 2" ?>
			  <?php echo "Writer 1,Writer 2," ?><?php endif ?>
              
			  <?php if($illustrators_visible == 1):?>
              <?php @$var19 = "Illustrator 1" ?>
              <?php @$var20 = "Illustrator 2" ?>
			  <?php echo  "Illustrator 1, Illustrator 2," ?><?php endif ?>
              
			  <?php if($paper_engineers_visible == 1):?>
              <?php @$var21 = "Paper engineer 1" ?>
              <?php @$var22 = "Paper Engineer 2" ?>
              <?php @$var23 = "Paper Engineer 3" ?>
			  <?php echo "Paper engineer 1, Paper Engineer 2, Paper Engineer 3," ?><?php  endif ?>
              
			  <?php  if(@$_REQUEST['save']):?>
              <br />
              <?php  endif ?>
              
           
                  <!--************************************
				Header Row End
		*************************************-->          
              <!--************************************
				Report Start
		*************************************-->
        <?php

// open CSV file for writing
$myfile = fopen("spread.csv", "w") or die("Unable to open file!");

// arrange headers into array and write to CSV file
 $headers = [];
 $headers[] = $var0;
 if ($location_visible) { $headers[] = $var1; }
 if ($publisher_visible) { $headers[] = $var2; }
 if ($publication_date_visible) { $headers[] = $var3; }
 if ($purchase_date_visible) { $headers[] = $var4; }
 if ($purchased_from_visible) { $headers[] = $var5; }
 if ($purchase_price_visible) { $headers[] = $var6; }
 if ($quality_visible) { $headers[] = $var7; }
 if ($get_better_copy_visible) { $headers[] = $var8; }
 if ($sale_date_visible) { $headers[] = $var9; }
 if ($sold_to_visible) { $headers[] = $var10; }
 if ($sale_price_visible) { $headers[] = $var11; }
 if ($genre_visible) { $headers[] = $var12; }
 if ($genre_2_visible) { $headers[] = $var13; }
 if ($comments_visible) { $headers[] = $var14; }
 if ($special_information_visible) { $headers[] = $var15; }
 if ($isbn_visible) { $headers[] = $var16; }
 if ($writers_visible) { $headers[] = $var17; }
 if ($writers_visible) { $headers[] = $var18; }
 if ($illustrators_visible) { $headers[] = $var19; }
 if ($illustrators_visible) { $headers[] = $var20; }
 if ($paper_engineers_visible) { $headers[] = $var21; }
 if ($paper_engineers_visible) { $headers[] = $var22; }
 if ($paper_engineers_visible) { $headers[] = $var23; }
fputcsv($myfile, $headers);

?>
		   <?php foreach ($booksRecords as $record): ?>
              
              <?php if(@$_REQUEST['save']):?>
              
         
              
              <?php if($record['title'] ):?>
			   <?php // Replace all commas with space and dash
					$title = $record['title'];
					$title = preg_replace("[,]", " -", $title); ?>
               <?php echo  htmlencode($title )?>,
			   
              <?php endif ?>
             
          <?php // ?>  
             
              <?php if(($location_visible == 1)):?>
              <?php if($record['location'] ):?>
              <?php // Replace all commas with space and dash
					  $location = $record['location:label'];
					  $location = preg_replace("[,]", " -", $location); ?>
              <?php echo htmlencode($location)?>,
			  
              <?php endif ?> <?php endif ?>
             
          <?php // ?>  
             
              <?php if(($publisher_visible == 1)):?>
              <?php if($record['publisher']):?>
              <?php // Replace all commas with space and dash
					  $publisher = $record['publisher'];
					  $publisher = preg_replace("[,]", " -", $publisher); ?>
			  <?php echo  htmlencode($publisher )?>,
               <?php else : ?>
              ,
              <?php endif ?><?php endif ?>
             
          <?php // ?>  
             
              <?php if(($publication_date_visible == 1)):?>
               <?php if($record['publication_date'] ):?>
              <?php // Replace all commas with space and dash
					  $publication_date = $record['publication_date'];
					  $publication_date = preg_replace("[,]", " -", $publication_date); ?>
			  <?php echo  htmlencode($publication_date )?>,
			  <?php else : ?>
              ,
  <?php endif ?> <?php endif ?>
			 
          <?php // ?> 
           
			  <?php if(($purchase_date_visible == 1)):?>
              <?php if($record['purchase_date']):?>
              <?php // Replace all commas with space and dash
					 $purchase_date = $record['purchase_date'];
					 $purchase_date = preg_replace("[,]", " -", $purchase_date); ?>
              
			  <?php echo  htmlencode($purchase_date )?>,
			  <?php else : ?>
              ,
              
              <?php endif ?><?php endif ?>
         
          <?php // ?>   
			  
			  <?php if(($purchased_from_visible == 1)):?>
               <?php if($record['purchased_from'] ):?>
              <?php // Replace all commas with space and dash
					  $purchased_from = $record['purchased_from'];
					  $purchased_from = preg_replace("[,]", " -", $purchased_from); ?>
              
			  <?php echo  htmlencode($purchased_from )?>,
			  <?php else : ?>
              ,
             
              <?php endif ?><?php endif ?>
             
          <?php // ?>  
             
              <?php if(($purchase_price_visible == 1)):?>
              <?php if($record['purchase_price'] ):?>
              <?php // Replace all commas with space and dash
					  $purchase_price = $record['purchase_price'];
					  $purchase_price = preg_replace("[,]", " -", $purchase_price); ?>
              
			  <?php echo  htmlencode($purchase_price )?>,
			  <?php else : ?>
              ,
              
              <?php endif ?> <?php endif ?>
              
          <?php // ?>  
		  
		  <?php if(($quality_visible == 1)):?>
              <?php if($record['quality']):?>
              <?php // Replace all commas with space and dash
					  $quality = $record['quality:label'];
					  $quality = preg_replace("[,]", " -", $quality); ?>
              
			  <?php echo  htmlencode($quality )?>,
			  <?php else : ?>
              ,
             
              <?php endif ?><?php endif ?>
              
          <?php // ?>  
			  
			  <?php if(($get_better_copy_visible == 1)):?>
              <?php if($record['get_better_copy']):?>
              <?php // Replace all commas with space and dash
					  $get_better_copy = $record['get_better_copy:text'];
					  $get_better_copy = preg_replace("[,]", " -", $get_better_copy); ?>
           
			  <?php echo $get_better_copy ?>,
			  <?php else : ?>
              ,
              
              <?php endif ?><?php endif ?>
              
          <?php // ?>  
			  
			  <?php if(($sale_date_visible == 1) ):?>
              <?php if($record['sale_date']):?>
              <?php // Replace all commas with space and dash
					  $sale_date = $record['sale_date'];
					  $sale_date = preg_replace("[,]", " -", $sale_date); ?>
              
			  <?php echo  htmlencode($sale_date)?>,
			  <?php else : ?>
              ,
              
              <?php endif ?> <?php endif ?>
              
          <?php // ?>  
			  
			  <?php if(($sold_to_visible == 1)):?>
              <?php if($record['sold_to']):?>
              <?php // Replace all commas with space and dash
					  $sold_to = $record['sold_to'];
					  $sold_to = preg_replace("[,]", " -", $sold_to); ?>
              
			  <?php echo  htmlencode($sold_to)?>,
			  <?php else : ?>
              ,
             
              <?php endif ?><?php endif ?>
			  
          <?php // ?>  
		  
		  <?php if(($sale_price_visible == 1)):?>
              <?php if($record['sale_price']):?>
              <?php // Replace all commas with space and dash
					 $sale_price = $record['sale_price'];
					 $sale_price = preg_replace("[,]", " -", $sale_price); ?>
              
			  <?php echo  htmlencode($sale_price )?>,
			  <?php else : ?>
              ,
              
              <?php endif ?><?php endif ?>
             
          <?php // ?>  
             
              <?php if(($genre_visible == 1)):?>
			  <?php if($record['genre']):?>
              <?php // Replace all commas with space and dash
					  $genre = $record['genre:label'];
					  $genre = preg_replace("[,]", " -", $genre); ?>
              
			  <?php echo htmlencode($genre) ?>,
			  <?php else : ?>
              ,
             
              <?php endif ?> <?php endif ?>
            
          <?php // ?>  
            
              <?php if(($genre_2_visible == 1)):?>
              <?php if($record['genre_2']):?>
              <?php // Replace all commas with space and dash
					  $genre_2 = $record['genre_2:label'];
					  $genre_2 = preg_replace("[,]", " -", $genre_2); ?>
             
			  <?php echo htmlencode($genre_2) ?>,
			  <?php else : ?>
              '
              
              <?php endif ?><?php endif ?>
              
          <?php // ?>  
			  
			  <?php if(($comments_visible == 1)):?>
              <?php if($record['comments']):?>
              <?php // Replace all commas with space and dash
					  $comments = $record['comments'];
					  $comments = preg_replace("[,]", " -", $comments); ?>
              
			  <?php echo htmlencode($comments ) ?>,
			  <?php else : ?>
              ,
             
              <?php endif?> <?php endif?>
              
          <?php // ?>  
			  
			  <?php if(($special_information_visible == 1)):?>
              <?php if($record['special_information']):?>
              <?php // Replace all commas with space and dash
					  $special_information = $record['special_information'];
					  $special_information = preg_replace("[,]", " -", $special_information); ?>
              
			  <?php echo htmlencode($special_information )?>,
			  <?php else : ?>
              ,
              
              <?php endif ?><?php endif ?>
             
          <?php // ?>  
             
              <?php if(($isbn_visible == 1)):?>
               <?php if($record['isbn']):?>
              <?php // Replace all commas with space and dash
					  $isbn = $record['isbn'];
					  $isbn = preg_replace("[,]", " -", $isbn); ?>
              
			  <?php echo  htmlencode($isbn )?>,
			  <?php else : ?>
              ,
           
              <?php endif ?> <?php endif ?>
            
          <?php // ?>  
            
              <?php if($writers_visible == 1):?>
              <?php if($record['writer_1'] ):?>
              <?php //Replace all commas with space and dash
					 $writer_1 = $record['writer_1'];
					 $writer_1 = preg_replace("[,]", " -", $writer_1); ?>
              
			  <?php echo  htmlencode($writer_1 )?>,
              <?php else :?>
              ,
              
              <?php endif ?>
             
          <?php // ?>   
			  
		 <?php if($record['writer_2'] ):?>
              <?php // Replace all commas with space and dash
					  $writer_2 = $record['writer_2'];
					  $writer_2 = preg_replace("[,]", " -", $writer_2); ?>
              
			  <?php echo  htmlencode($writer_2 )?>,
              <?php else :?>
              ,
              
              <?php endif ?>
              <?php endif ?>
              
          <?php // ?>  
              
              <?php if($illustrators_visible == 1):?>
              <?php if($record['illustrator_1'] ):?>
              <?php // Replace all commas with space and dash
					  $illustrator_1 = $record['illustrator_1'];
					  $illustrator_1 = preg_replace("[,]", " -", $illustrator_1); ?>
              
			  <?php echo  htmlencode($illustrator_1 )?>,
              <?php else :?>
              ,
             
              <?php endif ?>
             
          <?php // ?>  
          
              <?php if($record['illustrator_2'] ):?>
              <?php // Replace all commas with space and dash
					  $illustrator_2 = $record['illustrator_2'];
					  $illustrator_2 = preg_replace("[,]", " -", $illustrator_2); ?>
              
			  <?php echo  htmlencode($illustrator_2)?>,
              <?php else :?>
              ,
			 
              <?php endif ?>
              <?php endif ?>
             
          <?php // ?>  
             
              <?php if($paper_engineers_visible == 1):?>
              <?php if($record['paper_engineer_1'] ):?>
              <?php // Replace all commas with space and dash
					  $paper_engineer_1 = $record['paper_engineer_1'];
					  $paper_engineer_1 = preg_replace("[,]", " -", $paper_engineer_1); ?>
              
			  <?php echo  htmlencode($paper_engineer_1 )?>,
              <?php else :?>
              ,
              
              <?php endif ?>
             
          <?php // ?>  
             
              <?php if($record['paper_engineer_2'] ):?>
              <?php // Replace all commas with space and dash
					  $paper_engineer_2 = $record['paper_engineer_2'];
					  $paper_engineer_2 = preg_replace("[,]", " -", $paper_engineer_2); ?>
              
			  <?php echo  htmlencode($paper_engineer_2 )?>,
              <?php else :?>
              ,
              
              <?php endif ?>
             
          <?php // ?>  
             
              <?php if($record['paper_engineer_3'] ):?>
              <?php // Replace all commas with space and dash
					  $paper_engineer_3 = $record['paper_engineer_3'];
					  $paper_engineer_3 = preg_replace("[,]", " -", $paper_engineer_3); ?>
             
              <?php echo  htmlencode($paper_engineer_3 )?>,
              <?php else :?>
              ,
              
              <?php endif ?>
              <?php endif?>
              
              <?php  endif ?>
              <?php  if(@$_REQUEST['save']):?>
              <br />
              <?php  endif ?>
             
			 
                           
         



  <?php
   // arrange report values into array and write to CSV file
   $csvLine = [];
 $csvLine[] = @$title;
 if ($location_visible) { $csvLine[] = @$location; }
 if ($publisher_visible) { $csvLine[] = @$publisher; }
 if ($publication_date_visible) { $csvLine[] = @$publication_date; }
 if ($purchase_date_visible) { $csvLine[] = @$purchase_date; }
 if ($purchased_from_visible) { $csvLine[] = @$purchased_from; }
 if ($purchase_price_visible) { $csvLine[] = @$purchase_price; }
 if ($quality_visible) { $csvLine[] = @$quality; }
 if ($get_better_copy_visible) { $csvLine[] = @$get_better_copy; }
 if ($sale_date_visible) { $csvLine[] = @$sale_date; }
 if ($sold_to_visible) { $csvLine[] = @$sold_to; }
 if ($sale_price_visible) { $csvLine[] = @$sale_price; }
 if ($genre_visible) { $csvLine[] = @$genre; }
 if ($genre_2_visible) { $csvLine[] = @$genre_2; }
 if ($comments_visible) { $csvLine[] = @$comments; }
 if ($special_information_visible) { $csvLine[] = @$special_information; }
 if ($isbn_visible) { $csvLine[] = @$isbn; }
 if ($writers_visible) { $csvLine[] = @$writer_1; }
 if ($writers_visible) { $csvLine[] = @$writer_2; }
 if ($illustrators_visible) { $csvLine[] = @$illustrator_1; }
 if ($illustrators_visible) { $csvLine[] = @$illustrator_2; }
 if ($paper_engineers_visible) { $csvLine[] = @$paper_engineer_1; }
 if ($paper_engineers_visible) { $csvLine[] = @$paper_engineer_2; }
 if ($paper_engineers_visible) { $csvLine[] = @$paper_engineer_3; }
 
 fputcsv($myfile, $csvLine);
  ?>

 <?php endforeach ?>

<?php
// close CSV file
fclose($myfile);
?>
<?php  if(@$_REQUEST['save']):?><?php  echo '<script type="text/javascript">setTimeout("location.href=\'http://www.jkwebdesigns.com/eg/downloadcsv.php\'",2*1000)</script>'; ?><?php endif ?>
 
              <!--************************************
				Report End
		*************************************--> 
              <br /></td>
          </tr>
        </table>
        <!-- End Active Code Here --> 
      </div></td>
  </tr>
  <tr>
    <td><p>&nbsp;</p>
      <br />
      <br /></td>
  </tr>
</table>
</body>

