Click here to Skip to main content
13,803,804 members
Rate this:
Please Sign up or sign in to vote.
See more:
Hi all

I'm not a web developer, but have a specific basic need.
I have a test file with the following example data:


The text file has hundreds of lines

I would like to display the contents of the text file on a web page, maybe in groups of 8 or 16 at a time - not a priority, but nice.

I'd like a check box next to each entry, or maybe a better solution if you have one.
I would then like to export all checked entries to another text file after clicking a Go style button. This file should be over writable, so it can be used again.

Hope that makes sense.

I'm using Apache on Ubuntu 16.04



What I have tried:

Nothing tried yet, as I'm really not skilled in this
Dave Kreskowiak 3-Jan-18 16:59pm
OK, so what part of this are you having a problem with?

Or were you looking for someone to walk you through writing an entire web application?
Member 13605615 3-Jan-18 19:15pm
Not a walk through as such.
More of a confirmation that it's possible with text files, and a nudge on the right direction of which language I should use.
Member 13605615 4-Jan-18 12:53pm
OK, changed my mind a bit - Anyone out there spot what I've done wrong?

The output is just the word Array

I have a dropdown populated by a text file of values.

When I select 1 or more of these values, and submit, i was hoping to have the selected values sent to a text file. I just get Array

First file:

Please Choose One:
// define file
$file = '/home/user/hosts.list';

$handle = @fopen($file, 'r');
if ($handle) {
while (!feof($handle)) {
$line = fgets($handle, 4096);
$item = explode('|', $line);
echo '' . $item[0] . '' . "\n";


if(isset($_POST['host_id'])) {
$data = $_POST['host_id'] . "\r\n";
$ret = file_put_contents('/home/user/hosts.list.web', $data);
if($ret === false) {
die('There was an error writing this file');
else {
echo DONE;
else {
die('no post data to process');

Thanks all

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Cookies | Terms of Service
Web03 | 2.8.181218.1 | Last Updated 3 Jan 2018
Copyright © CodeProject, 1999-2018
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100