I'm trying to create a page where web surfer can choose a file by using radio buttons and then have this file e-mailed to him/her.
In order to prevent copious lines of code (if, elseif, etc...) I'm trying to assign into $filename variable a name of the real file that the script will use. The filename will be selected with radiobuttons and value of the selection should be applied into the path that points to the file.
At the moment "$fp = fopen($filename, "r");"
results only
(tones/.txt,"r") thus not very good at finding any files.
My newbie code:
<body bgcolor="#DDDDDD" text="#000000">
<form name="sendform" method="post" action="sendmail03.php">
<input type="radio" name="tonefile" value="dsandstorm">Sandstorm<br>
<input type="radio" name="tonefile" value="dfeelthebeat">Feel the Beat
<input type="submit" name="Submit" value="Submit">
</form>
</body>
<?
$filename = "tones/$tonefile.txt";
$fp = fopen($filename, "r");
$file_contents = fread($fp, filesize($filename));
fclose($fp);
//split with carriage return
$line = explode("\n", $file_contents);
//echo "$line[0]<br>";
//echo "$line[1]<br>";
//echo "$line[2]<br>";
?>
Script continues with e-mailing the contents of the file
Thank you for your help....
Petri