hi

i have a simple form with 4 radio buttons in index.php .
if the user selects any radio button and click on the submit button then he will downloaded the corresponding .swf file associated with that radio buttons in next page as download.php.

what ever the option is selected from the radio buttons the downloading is done in same download.php page.but this is not the correct one.

by doing the above functionality:

i am getting the url as:
http://localhost/download.php and the corresponding file is downloaded.


Actually i want the urls will be of the selected .swf name.

ex:

http://localhost/swf_filename1.php
http://localhost/swf_filename2.php
http://localhost/swf_filename3.php
http://localhost/swf_filename4.php

instead of getting the http://localhost/download.php.


inorder to get a clear idea about my requirement i ahve attached my code .

pls go through that. and help me.


thanks

This is an easy one.

Just create a "dispatch" PHP script that acts as proxy for the download requests. Here is a sample code:

<form method="post">
<input type="radio" name="file" value="swf_filename1" checked="checked" />
<input type="radio" name="file" value="swf_filename2" />
<input type="radio" name="file" value="swf_filename3" />
<input type="radio" name="file" value="swf_filename4" />
<input type="submit" value="Download" />
</form>
<?php
if (isset($_POST['file'])) {
	$valid = array('swf_filename1', 'swf_filename2', 'swf_filename3', 'swf_filename4');
	if (in_array($_POST['file'], $valid)) {
	   include($_POST['file'] . '.php');
	} else {
		print('File Not Found');
	}
}
?>