I’ve been attempting to associate a PHP script with an HTML dropdown menu. What this PHP script will do, is take the input from the textarea, and then onsubmit it will request the user to download the input or “file” from the form. However, I would also like it so that each selection from the dropdown list will have it’s own extension when downloaded. For example: If one of the dropdown options was “PHP”, and that option was selected, when the user goes to save the file via a “Save As” button, the file will automatically contain the extension “.php” and so forth. Is it possible to do this somehow?
Share
Assuming you have a form that looks something like:
Then in your PHP file you would just concatenate the two values together:
And then send back the link to the file to the user.
Edit: Possible example of a full PHP file:
myphpfile.php: