Hey guys,
Hopefully this is possible? Basically i am making a awesome little script maker. Anyways i have a HTML page with questions, the questions can be answered by filling out the html5/css3 coded <input></input> areas. Now here is where i am stuck, when they answer the questions and click on "Open" it redirects them to a page with their answers, displayed and ordered the way i want it to.
Now the question is, how can i then make it so instead of just viewing their <input></input> answers from using a "Open" button, which works fine, how can they actually download the answers?
I have tried making a PHP script that is executed when they click on a "Download" button for example:
<input type="button" name="downloadtest" value="Download" önclick="location.href='downloadit.php';" >
Which i have managed so that, if accessed they will be prompted to download the file. Here is an example php of what i am using:
<?php
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="burgostest.html"');
echo "//////////////////////////////////////////////////// \r\n";
echo "// © BURGO855's ONLINE TESTTTTTTTTTTTTTTTTTTTTT © // \r\n";
echo "//////////////////////////////////////////////////// \r\n";
echo " \r\n";
echo "Special TEST \r\n";
echo " \r\n";
echo "//////////////////////////////////////////////////// \r\n";
echo "// TEST: // \r\n";
echo "//////////////////////////////////////////////////// \r\n";
echo " \r\n";
echo "My name is "+myname" \r\n";
echo "I: ". $_GET['dodont']. "Don't like food \r\n";
?>
The issue is that it fails to grab the "dodont" input answer($_GET['dodont']) from the html page. So i am trying to work out a way around this. It would save me time if i can set up the "Download" button to simply use the "Open" php file and basically copy the answers from this page and give them a download link to it, i really don't know how to make this possible but i am sure their is a way to do this? Maybe even if i have to embed the php script into the html and set up the download button to just use it that way? I'm guessing it is not working because the $_GET is trying to collect data/answers from a separate html/php page? Is their a way to maybe do this in JS instead maybe? I just need an example and i should be good.
I have altered the text and button names and php names as this is a private thing i am working on, i also understand that the $_GET method is dodgy and unsecure but that is ok because the answers and stuff doesn't need to be classed or considered confidential anyways it doesn't matter if others somehow get access to it.
Anyone have any ideas?
Cheers,
-Burgo855.