markinoz has asked for the wisdom of the Perl Monks concerning the following question:
Hi
I have a survey script that I need to hack, and cant work it out.
There is a string called $FORM{'survey'}, this is inputted from a form and the script removes any whitespace so it can be passed thru a url ( with me so far?? )
The problem is when I return $survey it has the underscores in the survey name and my client would like them removed.
Is there a way I can replace the underscore chars with white spaces ( this isnt going to be passed to the url its just for a html table title. )
well actually I know there is a way to do this but I cant work it out
I have pasted some of the code at the bottom so maybe someone could point me in the right direction??
Thanks
Mark R
<TABLE BGCOLOR="$table_bgcolor" CELLSPACING="$table_cellspacing" CELLP +ADDING="$table_cellpadding" BORDER="$table_border" WIDTH="$table_widt +h"> <TR BGCOLOR="$table_caption_row_color"><TD COLSPAN=2> <FONT FACE=\"$font_type\" SIZE=\"$caption_font_size\" COLOR=\" +$table_font_caption_color\"><B> Online Surveys</B></FONT></TD></TR> !; opendir(SOFFICE,"$surveyoffice_base_dir") || &error("Unable to + read from Survey directory"); while($file = readdir(SOFFICE)) { if($file =~ /^(.*).info$/) { $survey = $1; if(-e "$surveyoffice_base_dir/$survey.rclosed" && -e "$surveyoffice_ba +se_dir/$survey.closed") { next; } print "<TR BGCOLOR=\"$table_row_color\"><TD><FONT FACE +=\"$font_type\" SIZE=\"$font_size\" COLOR=\"$table_font_color\">$surv +ey</FONT></TD><TD>\n"; if(! -e "$surveyoffice_base_dir/$survey.rclosed") { print "<A HREF=\"survey.cgi?action=view&survey=$su +rvey\"><font face=\"arial\" size=\"1\">View Results</A>\n"; } else { print "<font face=\"arial\" size=\"1\">Results Not + Available\n"; }
as you can see $survey is used for the table title ( html ) and also used to pass the address to the script thru the url.
I was hoping to make a copy of $survey ( $survey1??? ) and remove the _ chars and use $survey1 for my html title.
I have tried hardcoding $survey1 = "title here" and it worked fine
all I need to know is how to duplicate the $survey
Thanks Again
Edited 2002-06-13 by mirod: changed the title (was: URGTENT: Need to remove undescore characters) and added <p> tags
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Replacing undescore characters with whitespace
by cjf (Parson) on Jun 13, 2002 at 11:31 UTC | |
Re: URGTENT: Need to remove undescore characters
by Abigail-II (Bishop) on Jun 13, 2002 at 12:13 UTC | |
by ariels (Curate) on Jun 13, 2002 at 12:40 UTC | |
Re: URGTENT: Need to remove undescore characters
by u914 (Pilgrim) on Jun 13, 2002 at 14:45 UTC | |
by markinoz (Initiate) on Jun 14, 2002 at 02:39 UTC | |
by u914 (Pilgrim) on Jun 14, 2002 at 13:42 UTC |