Click here to Skip to main content
13,398,905 members (33,577 online)
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:

TXT1-1-2-1
TXT1-1-3-2
TXT1-3-4-2
TXT2-9-8-1
TXT2-16-1-1

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


Cheers


Preston

What I have tried:

Nothing tried yet, as I'm really not skilled in this
Posted 3-Jan-18 11:22am
Comments
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:
<?php
// 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";
}
fclose($handle);
}
?>



__________________________________________
action.php

<?php
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 |
Web04 | 2.8.180218.2 | Last Updated 3 Jan 2018
Copyright © CodeProject, 1999-2018
All Rights Reserved. Terms of Service
Layout: fixed | fluid

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