Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsOtherProgramming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old July 22nd, 2005, 02:16 PM
ehsanking ehsanking is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Apr 2005
Posts: 207 ehsanking User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 20 h 3 m 51 sec
Reputation Power: 4
Arrow Problem writing multiple songs url to text file

Hi experts. I got a perl script that supposed to write song urls to text file but unfortuenly it writes only one song on the text file. If i select song 2 and song 3 from check box it only writes the latest one which is 3. Is there a way to write multiple songs to text file since i am using check boxes . Like example below
http://localhost/cgi-bin2/textchat/...me=ID4&name=ID7

I be happy if an expert help me fix this thanks

Code:
#!/usr/bin/perl

 
SWITCH:
{

@pairs = split(/&/, $ENV{"QUERY_STRING"});

foreach $pair (@pairs) {
 ($name, $value) = split (/=/, $pair);
 $formData{"$name"} = $value;
}

$fname = $formData{name};

if( $fname eq "ID1" )
{
$fname="http://localhost/songs/g1.rm";
   last SWITCH;
}
if($fname eq "ID2")
{
$fname="http://localhost/songs/g2.rm";
last SWITCH;
      
}

if($fname eq "ID3")
{
$fname="http://localhost/songs/g3.rm";
last SWITCH;
      
}
if($fname eq "ID4")
{
$fname="http://localhost/songs/g4.rm";
last SWITCH;
      
}
DEFAULT:
{
$fname="http://localhost/salma/m7.rm";
last SWITCH;
}
}#END OF SWITCH BLOCK




$outfile= 'songlist.txt';
open(OUTPUT, ">$outfile")or die "Can't open $outfile";

close(OUTPUT);


##################################################  ###############################
#Defult Subroutines
 


print <<method;

<html>
<head>
        <title>Voice Music</title>
</head>

<script language=JavaScript src="http://localhost/dll.js">
</script>


<body bgColor=#336699 leftmargin="0" topmargin="0">

#Real Audio Applet
<OBJECT ID=video1 CLASSID="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" HEIGHT=60 WIDTH=285>
<PARAM NAME="controls" VALUE="ControlPanel,StatusBar">
<PARAM NAME="console" VALUE="Clip1">
<PARAM NAME="autostart" VALUE="true">
<PARAM NAME="src" VALUE="http://localhost/cgi-bin2/songlist.txt">
<EMBED SRC="$fname" type="audio/x-pn-realaudio-plugin" CONSOLE="Clip1" CONTROLS="ControlPanel,StatusBar" HEIGHT=60 WIDTH=285 AUTOSTART=true>
</OBJECT>

</body>

</html>

method

Reply With Quote
  #2  
Old July 24th, 2005, 08:43 AM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Moderator From Beyond
ASP Free God 46th Plane (27500 - 27999 posts)
 
Join Date: Sep 2004
Location: Israel
Posts: 27,635 Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 14th Grade (Above 100000 Reputation Level)  Folding Points: 373781 Folding Title: Super Ultimate Folder - Level 1Folding Points: 373781 Folding Title: Super Ultimate Folder - Level 1Folding Points: 373781 Folding Title: Super Ultimate Folder - Level 1Folding Points: 373781 Folding Title: Super Ultimate Folder - Level 1Folding Points: 373781 Folding Title: Super Ultimate Folder - Level 1Folding Points: 373781 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 2 Weeks 2 h 55 m 37 sec
Reputation Power: 1902
please stop deleting and re-posting the same question again and again.

as for your question: I'm not perl programmer but looks like the logic used is wrong. you must use some sort of loop to iterate over the selected checkboxes, I couldn't see any such loop apart of this:
Code:
foreach $pair (@pairs) {
 ($name, $value) = split (/=/, $pair);
 $formData{"$name"} = $value;
}

which probably store the current value in the variable $formData{"$name"} - and so you have only the last value stored there.

you might get more help in perl forum, look in the main devshed website there is perl-specific forum in there.

Reply With Quote
Reply

Viewing: ASP Free ForumsOtherProgramming Help > Problem writing multiple songs url to text file


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT