Scope: My php code generates a list of files, the links send a link to php with the request to rename the file.
What I would like is to have a prompt box instead of an alert box. The prompt box shows the original filename and asks a new filename. All variables are then sent back to the script so I can catch them up in php.
Additionally it would be nice to have the original filename as value in the promptbox for easy editing.
OK sends out the request "?action=rename&filenameold=filename1.txt&filenamenew=filename1x.txt" CANCEL does nothing
The "get" method should be used when the form is idempotent (i.e., causes no side-effects). Many database searches have no visible side-effects and make ideal applications for the "get" method.
If the service associated with the processing of a form causes side effects (for example, if the form modifies a database or subscription to a service), the "post" method should be used.
In your example, the processing of this data would cause a side effect (the file will be renamed), so a POST should be used.
Now, as for how to achieve the UI, you won't be able to rely on the built in alert/confirm methods if you want to display a dialog that contains an input for the new filename. You may want to check out the Yahoo UI Library (YUI) for accomplishing this. With YUI3, you'd be looking at using Overlay (http://developer.yahoo.com/yui/3/overlay/), and with YUI2 you'd be looking at one of the Container components (http://developer.yahoo.com/yui/container/), probably Dialog which has an example that you might be able to base yours off of (http://developer.yahoo.com/yui/examples/container/dialog-quickstart.html).
1. The LANGUAGE attribute is invalid. Use the type attribute instead. 2. Don't include HTML comments inside script elements. This hasn't been needed for 15 years or so. So your code should look more like this: