javascript - Multiple select checkboxes, what user select combines it into one file -
i'm start project @ school - wan't clear out way best way go. seek describe solution want achieve.
the project: project appending files one, decided user select things should in file using checkboxes select it.
we need create multiple selection fields checkboxes this:
<p>please create selection newspapers subscribe to: </p> <form> <!-- input fields should linked separate files --> <input type="checkbox" name="newyorktimes" value="newyorktimes">new york times <input type="checkbox" name="thesun" value="thesun">the sun <input type="checkbox" name="thewallstreetjournal" value="thewallstreetjournal">the wall street journal </form>
then users select should combined in 1 file combining them list , info separate files:
file: subscriptions_29102014_1119.txt
userid: #1337 ip address: 10.10.13.37 subscriptions made on 29/10/2014 new york times 29/10/2014 - 13:37 obama ready leave throne when time comes. sun 29/10/2014 - 13:38 beatles in london wall street journal 29/10/2014 - 13:39 twitter looses 1 time again
this illustration maybe describe you.
i not sure if you're getting point, describe 1 time again read this: lets in webroot folder got 10 different files containing different info or settings, whatever, doesn't same. users selections in checkboxes,the selected files should combined 1 file.
you work same way costumize function twitter bootstrap 3 @ http://getbootstrap.com/customize - compile in 1 file.
i hope clarifies , come suggestion on how this. know little php , prefer in php myself. suggestion?
i think should help you
<?php if (!empty($_post['files'])) { $content = ""; foreach ($_post['files'] $file) { if (file_exists($file.".txt")) { $content .= file_get_contents($file.".txt"); } } $filename = 'test-download.txt'; header("cache-control: public"); header("content-description: file transfer"); header("content-disposition: attachment; filename=$filename"); header("content-type: application/octet-stream; "); header("content-transfer-encoding: binary"); echo $content; }else{ ?> <!doctype html> <html> <head> <title>test</title> </head> <body> <form method="post"> <!-- input fields should linked separate files --> <input type="checkbox" name="files[]" value="newyorktimes">new york times <input type="checkbox" name="files[]" value="thesun">the sun <input type="checkbox" name="files[]" value="thewallstreetjournal">the wall street journal <input type="submit"> </form> </body> </html> <?php } ?>
it check files selected in checkbox list , combine contents 1 downloadable file
javascript php html checkbox twitter-bootstrap-3
No comments:
Post a Comment