Fantastic.
Looking forward to hear what you find.
Looking forward to hear what you find.
Morning Eric,
I thought i would make an entirely new Web Form to check and see if i have the same issue.
I also added a bunch of extra trailers just so i could play with your script and learn.
All the parsing works beautifully but it encounters the same problem as the previous form after submission.
Just thought i would let you know.
Here is the link anyways:
https://files.farmtronics.com.au/004WZt … testDR.php
I thought i would make an entirely new Web Form to check and see if i have the same issue.
I also added a bunch of extra trailers just so i could play with your script and learn.
All the parsing works beautifully but it encounters the same problem as the previous form after submission.
Just thought i would let you know.
Here is the link anyways:
https://files.farmtronics.com.au/004WZt … testDR.php
The issue was on the first page load if the csv file didn't exist. I tweaked the code to accommodate that.
Slight change to the inputs.
Also one more additional piece of code.
You can put this in the head area of your form like above the <title>
It will reset your form on page load. I saw values still being selected from the previous submit and that isn't desirable.
<?php
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
$csv_data ='storage/csv/WZ.csv';
if (file_exists($csv_data)) {
$f = fopen($csv_data, "r");
date_default_timezone_set('Australia/Melbourne');
$sumTrailerA = array();
$sumTrailerB = array();
$sumTrailerC = array();
$sumTrailerD = array();
$sumTrailerTotals = array();
while (($line = fgetcsv($f)) !== false) {
$submitted_date = $line[0];
$current_date_formatted = date("d/m/Y");
if( $submitted_date == $current_date_formatted){
$Trailer=preg_replace('/\s+/', '', $line[7]);
if($Trailer == "TrailerA"){
array_push($sumTrailerA,$line[11]);
}else if($Trailer == "TrailerB"){
array_push($sumTrailerB,$line[11]);
}else if($Trailer == "TrailerC"){
array_push($sumTrailerC,$line[11]);
}else if($Trailer == "TrailerD"){
array_push($sumTrailerD,$line[11]);
}
array_push($sumTrailerTotals,$line[11]);
}
}
fclose($f);
}
?>
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
$csv_data ='storage/csv/WZ.csv';
if (file_exists($csv_data)) {
$f = fopen($csv_data, "r");
date_default_timezone_set('Australia/Melbourne');
$sumTrailerA = array();
$sumTrailerB = array();
$sumTrailerC = array();
$sumTrailerD = array();
$sumTrailerTotals = array();
while (($line = fgetcsv($f)) !== false) {
$submitted_date = $line[0];
$current_date_formatted = date("d/m/Y");
if( $submitted_date == $current_date_formatted){
$Trailer=preg_replace('/\s+/', '', $line[7]);
if($Trailer == "TrailerA"){
array_push($sumTrailerA,$line[11]);
}else if($Trailer == "TrailerB"){
array_push($sumTrailerB,$line[11]);
}else if($Trailer == "TrailerC"){
array_push($sumTrailerC,$line[11]);
}else if($Trailer == "TrailerD"){
array_push($sumTrailerD,$line[11]);
}
array_push($sumTrailerTotals,$line[11]);
}
}
fclose($f);
}
?>
Slight change to the inputs.
value="<?php echo (array_sum($sumTrailerA)>0 ? array_sum($sumTrailerA) : '');?>"
value="<?php echo (array_sum($sumTrailerB)>0 ? array_sum($sumTrailerB) : '');?>"
value="<?php echo (array_sum($sumTrailerC)>0 ? array_sum($sumTrailerC) : '');?>"
value="<?php echo (array_sum($sumTrailerD)>0 ? array_sum($sumTrailerD) : '');?>"
value="<?php echo (array_sum($sumTrailerTotals)>0 ? array_sum($sumTrailerTotals) : '');?>"
Also one more additional piece of code.
You can put this in the head area of your form like above the <title>
It will reset your form on page load. I saw values still being selected from the previous submit and that isn't desirable.
<script>
function init() {
document.getElementById("docContainer").reset();
}
window.onload = init;
</script>
function init() {
document.getElementById("docContainer").reset();
}
window.onload = init;
</script>
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
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
I have a funeral today unfortunately but I will give it a go on my return and keep you posted.
Thanks Eric.
Thanks Eric.
Hi Eric,
The CSV files was always there, but i tried the new script and it still hangs after i submit the form unfortunately.
It is trying to take me back to this page https://files.farmtronics.com.au/004WZ_ … 004WZ.php.
Instead of https://files.farmtronics.com.au/004WZ_ … /004WZ.php
The CSV files was always there, but i tried the new script and it still hangs after i submit the form unfortunately.
It is trying to take me back to this page https://files.farmtronics.com.au/004WZ_ … 004WZ.php.
Instead of https://files.farmtronics.com.au/004WZ_ … /004WZ.php
Can you look on your host in that directory for an error_log type file?
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
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
Give this file a try. See attached
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
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
I tried the files you sent me and had the same result.
Here are the Error Logs:
Tue, 11 Jan 2022 01:20:20 +0000: Couldn't open or read: 004WZ.html
Tue, 11 Jan 2022 01:20:23 +0000: Couldn't open or read: 004WZ.html
Tue, 11 Jan 2022 02:16:59 +0000: Couldn't open or read: 004WZ.html
Tue, 11 Jan 2022 02:17:10 +0000: Couldn't open or read: 004WZ.html
Tue, 11 Jan 2022 02:17:56 +0000: Couldn't open or read: 004WZ.html
Tue, 11 Jan 2022 02:17:56 +0000: Failed to parse HTML form.
Tue, 11 Jan 2022 02:17:56 +0000: Couldn't open or read: 004WZ.html
Here are the Error Logs:
Tue, 11 Jan 2022 01:20:20 +0000: Couldn't open or read: 004WZ.html
Tue, 11 Jan 2022 01:20:23 +0000: Couldn't open or read: 004WZ.html
Tue, 11 Jan 2022 02:16:59 +0000: Couldn't open or read: 004WZ.html
Tue, 11 Jan 2022 02:17:10 +0000: Couldn't open or read: 004WZ.html
Tue, 11 Jan 2022 02:17:56 +0000: Couldn't open or read: 004WZ.html
Tue, 11 Jan 2022 02:17:56 +0000: Failed to parse HTML form.
Tue, 11 Jan 2022 02:17:56 +0000: Couldn't open or read: 004WZ.html
Ty this.
Open the 004WZ.php form page and save it as 004WZ.html and upload that to your server.
Then test the 004WZ.php form page.
Open the 004WZ.php form page and save it as 004WZ.html and upload that to your server.
Then test the 004WZ.php form page.
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
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
To me being an amateur after a form submission WFB seems to be wanting to open the original 004WZ.html file which we now have renamed 004WZ.php.
It also seems to want to open the 004WZ.php in the root directory after a submission and not the new 004WZ.php file in the sub directory ??
Probably means nothing but just thought i would mention it.
It also seems to want to open the 004WZ.php in the root directory after a submission and not the new 004WZ.php file in the sub directory ??
Probably means nothing but just thought i would mention it.
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.