Form Results to HTML File

User 2301173 Photo


Guest
1 post

Has anyone had any luck outputting form results to an HTML File? NOT using S-Drive... Any help would be appreciated!

Thanks
User 464893 Photo


Ambassador
1,611 posts

You need to use a php script to do so. A redirect is made to a php file that reads the csv file or MySQL database and displays the result.
The form builder collects and stores data only. Below is some code I used as a demo once. This extracts the last data entry from a csv file. Items start at 0 (4) is the 5th item stored in the csv.
$data1 & 2 are the variables that can be displayed in a html file by using this command
<?php echo $data1; ?>

<?php
error_reporting(E_ALL & ~E_NOTICE);
$file_handle = fopen("Path/storage/csv/results.csv", "r");// the address where the file is located
while (!feof($file_handle)){
$item = fgetcsv($file_handle, 1024);
if($item=="")Break;// make sure the last entry is used
$lastitem=$item;
}
fclose($file_handle);
$data1 = $lastitem[0];
$data2= $lastitem[1];

?>

The Guy from OZ


User 187934 Photo


Senior Advisor
20,193 posts
Online Now

I'm using the form builder as the front end of an inventory script. The back end is a bunch of php squeezing some mysql to extract the needed info after the form is submitted. With this setup you can do lots of things.
Here's another script using the form builder. It's a voting poll.:cool:
Please Vote
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 464893 Photo


Ambassador
1,611 posts

Great example, well done Eric
The Guy from OZ



Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.