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


In reply to Replacing underscore characters with whitespace by markinoz

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.