I'm sure I'm missing something horribly obvious in this.
I set up a csv export page as per http://www.couchcms.com/forum/viewtopic.php?f=3&t=8157&p=14962&hilit=csv#p14962.
Here's that code:
And then I'm calling that file (csv_export.php) over from this page:
When I click the "export" button on the page that displays the information, I get nothing at all. If I navigate directly to the page, then it downloads, but as a php file rather than .csv. Help?
I set up a csv export page as per http://www.couchcms.com/forum/viewtopic.php?f=3&t=8157&p=14962&hilit=csv#p14962.
Here's that code:
- Code: Select all
<?php require_once ( '../couch/cms.php' ); ?>
<cms:content_type 'text/csv' />
First Name,Last Name,School,Grade,Age,Card Number,Hours or Books,Phone,Email,Library
<cms:pages masterpage='members/srp_database.php' folders=chosen_folders >
<cms:show first_name />,<cms:show last_name />,<cms:show school_attended />,<cms:show grade_level />,<cms:show age />,<cms:if pines_identifier><cms:show pines_identifier /><cms:else />0</cms:if>,<cms:show program_type_completed />,<cms:if contact_phone><cms:show contact_phone /><cms:else />None</cms:if>,<cms:if contact_email><cms:show contact_email /><cms:else />none</cms:if>,<cms:show k_folder_title />
</cms:pages>
<?php COUCH::invoke(); ?>
And then I'm calling that file (csv_export.php) over from this page:
- Code: Select all
<?php require_once ( '../couch/cms.php' ); ?>
<cms:template title='SRP Readout Page' />
<cms:member_check_login />
<cms:if k_member_logged_in >
<!DOCTYPE HTML>
<html>
<head>
<cms:embed 'header.html' />
</head>
<body>
<div class="container-fluid">
<cms:embed 'menu.html' />
<cms:form enctype="multipart/form-data" method="post" class="k_form" anchor='1'>
<label>Choose your SRP Database Source(s)</label><p/>
<cms:input type='checkbox' required='1' name='srp_source' opt_values=" Evans Library=evans_srp | Euchee Creek=euchee_srp | Harlem=harlem_srp | | Burke County=burke_srp | Midville=midville_srp | Sardis=sardis_srp | | Lincoln County=lincoln_srp | Warren County=warren_srp " />
<p/>
<button type='submit' class='btn btn-default'>Submit</button><p/>
<cms:if k_success >
<cms:set chosen_folders=frm_srp_source 'global' />
<a target="_blank" href="csv_export.php"><button class='btn btn-default'>Export to CSV</button></a>
<table id='datatable' class='table table-striped'>
<tr>
<th>First Name</th>
<th>Last Name</th>
<th>School</th>
<th>Grade</th>
<th>Age</th>
<th>Card Number</th>
<th>Hours or Books</th>
<th>Phone</th>
<th>Email</th>
<th>Branch</th>
</tr>
<cms:pages masterpage='members/srp_database.php' folders="<cms:show frm_srp_source />" >
<tr>
<td><cms:show first_name /></td>
<td><cms:show last_name /></td>
<td><cms:show school_attended /></td>
<td><cms:show grade_level /></td>
<td><cms:show age /></td>
<td><cms:show pines_identifier /></td>
<td><cms:show program_type_completed /></td>
<td><cms:show contact_phone /></td>
<td><cms:show contact_email /></td>
<td><cms:show k_folder_title /></td>
</tr>
</cms:pages>
</table>
<cms:else />
<h3 class='bg-warning'>You must select a branch or branches to pull SRP records from.</h3>
</cms:if>
</cms:form>
</div>
</body>
</html>
<cms:else />
<cms:redirect k_site_link />
</cms:if>
<?php COUCH::invoke(); ?>
When I click the "export" button on the page that displays the information, I get nothing at all. If I navigate directly to the page, then it downloads, but as a php file rather than .csv. Help?