Ok this is hard to explain so bare with me. What I want to do is take input from a dropdown list box and use it in 2 different functions in a php script.
Here is the drop down code:
code:
<select name="song_genre" id="song_genre">
<option selected>select one</option>
<option>----------------------------</option>
<option value="techno">Techno</option>
<option value="hip-hop">Hip-Hop</option>
</select>
And here is the php that I need to work:
code:
<?php
include "link.php";
$file="filecount.txt";
$handle=fopen($file, "r+");
$hits=fread($handle,filesize("$file"));
$hits+=1;
fclose($handle);
$handle=fopen($file, "w");
fwrite($handle, $hits);
$file = fopen("$hits.html","w");
$filenamesong = "song.mrn";
$html = "<a href='http://www.beachassaultstudios.com/mrn/newfiles/$hits.html'target=frame2><font color='#FFFFFF'>$song_name</font></a><font color='#FFFFFF'>, posted by $artist </font>\n";
$fp = fopen($filenamesong, 'a+');
fputs($fp, $html) or die("Could not open file!");
fclose($fp);
fclose($handle);
fwrite($file,"<html>
<head>
<title>MRN Radio Now Playing - &song_name By: $artist</title>
</head>
<body bgcolor='#000000' topmargin='0' leftmargin='0'>
<table border='2' width='31%' bordercolorlight='#000000' bordercolordark='#000000' height='195' bordercolor='#000080'>
<tr>
<td bordercolorlight='#000080' bordercolordark='#000080' bordercolor='#000000' bgcolor='#000000' height='174'>
<address>
<font face='Verdana' size='2' color='#FFFFFF'><span style='font-style: normal'><b>Song Name:</b> $song_name</span></font></address>
<address>
<font face='Verdana' size='2' color='#FFFFFF'><span style='font-style: normal'><b>Artist:</b> $artist</span></font></address>
<address>
<font face='Verdana' size='2' color='#FFFFFF'><span style='font-style: normal'><b>Song Genre:</b> $song_gender</span></font></address>
<address>
<font face='Verdana' size='2'><span style='font-style: normal'>
<font color='#FFFFFF'><b>Email:</b>
</font>
<a href='mailto:$email'><font color='#FFFFFF'>$email</font></a><font color='#FFFFFF'>
</font> </span></font>
</address>
<address>
<font face='Verdana' size='2'><span style='font-style: normal'>
<font color='#FFFFFF'><b>Website:</b>
</font>
<a href='$artist_website' target='_blank'><font color='#FFFFFF'>Visit Artists Website</font></a></span></font></address>
<address>
</address>
<address>
<span style='font-style: normal'><font face='Verdana' size='2'><b>
<font color='#FFFFFF'>Description:</font><br></b></font></span>
<textarea rows='2' name='S1' cols='35'>$description</textarea></address>
<form method='POST' action='--WEBBOT-SELF--' onSubmit='location.href='_derived/nortbots.htm';return false;' webbot-onSubmit>
<!--webbot bot='SaveResults' U-File='_private/form_results.csv' S-Format='TEXT/CSV' S-Label-Fields='TRUE' startspan --><input TYPE='hidden' NAME='VTI-GROUP' VALUE='0'><!--webbot bot='SaveResults' i-checksum='43374' endspan -->
</form>
</td>
</tr>
<tr>
<td bordercolorlight='#000080' bordercolordark='#000080'>
<!--webbot bot='HTMLMarkup' startspan --> <object classid='CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95' codebase='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701'standby='Loading Microsoft Windows Media Player components...' type='application/x-oleobject' width='305' height='72' id='playa'>
<param name='FileName' value='$filename'>
<param name=AutoSize value=false>
<param name=DisplaySize value=0>
<param name=ShowControls value=1>
<param name=ShowDisplay value=0>
<param name=ShowStatusBar value=1>
<param name=AutoStart value=TRUE>
<embed width='305' height='72' type='application/x-mplayer2' pluginspage='http://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/' src='$filename' ShowControls='1' AutoStart=True ShowDisplay='0' ShowStatusBar='1'></EMBED>
</object>
<!--webbot bot='HTMLMarkup' endspan --></td>
</tr>
</table>
<p></a>
</p>
</body>
</html>");
fclose($file);
for($i=0;$i<sizeof($userfile);$i++)
{
if(!$userfile_size[$i])
continue;
$UPLOAD = fopen( $userfile[$i], "r" );
$contents = fread( $UPLOAD,$userfile_size[$i]);
fclose( $UPLOAD );
$SAVEFILE = fopen( $userfile_name[$i], "wb" );
fwrite( $SAVEFILE, $contents,$userfile_size[$i] );
fclose( $SAVEFILE );
}
echo "Song is now uploaded. Click <a href='viewsongs.php'>here</a> to go to radio";
?>
Sorry for the length of the code, but you need to see it all to get what I’m trying to do here.
Ok to make this easier I’ll do it in steps.
1. First there user selects a song genre from the form.
2. Seconded the user clicks submit
*Now the php code comes in
3. Song uploads
3. The php takes the song_genre variable from the drop down and writes it to the songs html page.
4. (This is the part I need help with) the php will look at the variable and see if it is techno, or hiphop and decide what to do.
Example: If song_genre = techno then also write link to song in techno.mrn
and so on for each variable in the drop down.
this is the section of code that writes to the song.mrn (main file)
code:
$filenamesong = "song.mrn";
$html = "<a href='http://www.beachassaultstudios.com/mrn/newfiles/$hits.html'target=frame2><font color='#FFFFFF'>$song_name</font></a><font color='#FFFFFF'>, posted by $artist </font>\n";
$fp = fopen($filenamesong, 'a+');
fputs($fp, $html) or die("Could not open file!");
fclose($fp);
I hope I didn't confuse the question. Can any one help? Thanks.