Q: HTML DropDown Menu with PHP Download 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?

A: Yes.
One way, which you suggest, would be to do handle the form as a POST submission: On the client side, have your form choose the extension stored in the fields value attribute. On the server side, check the $_POST var for your $_POST[ 'field' ].  
Another way to do it would be add an iFrame to the document with it's source set to a script that returns the resource. In that case, it would look like script.php?field=value and you'd check the $_GET variable for your $_GET[ 'field' ] to determine the extension type you're setting in PHP.

A: Assuming you have a form that looks something like:
<form action='myphpfile.php' method='post'>
    <input type='text' name='filename' /> 
    <select name='extension'>
        <option value='php'>PHP</option>
        <option value='html'>HTML</option>
    </select>
    <input type='submit' value='Save As' />
</form>

Then in your PHP file you would just concatenate the two values together:
$file = $_POST['filename'] . '.' . $_POST['extension'];

And then send back the link to the file to the user.
Edit: Possible example of a full PHP file:
myphpfile.php:
<?php
$file = $_POST['filename'] . '.' . $_POST['extension'];
header("Content-disposition: attachment; filename=$file");
readfile($file);
?>

