Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with if...

Status
Not open for further replies.

Cloud1

Programmer
Jun 23, 2001
6
CA
First I have this:

if ($UBBCodeAllow eq "yes") {
$UBBCodeyes = "CHECKED";
} else {
$UBBCodeno = "CHECKED";
}


Then after I have:

<td width=50% valign=top>
<FONT SIZE=&quot;2&quot; FACE=&quot;Verdana, Arial&quot;><B><INPUT TYPE=&quot;RADIO&quot; NAME=&quot;UBBCodeAllow&quot; VALUE=&quot;yes&quot; $UBBCodeyes>
Allow UBB Code
<BR>
<INPUT TYPE=&quot;RADIO&quot; NAME=&quot;UBBCodeAllow&quot; VALUE=&quot;no&quot; $UBBCodeno>
Don't Allow UBB Code</B></FONT>
</td></tr>


On my variable file, I have it like $BBCodeAllow = &quot;yes&quot;;

After when I go back to the form, it does not show &quot;CHECKED&quot; when I view the source. Please tell me what I'm doing wrong. Thank you.
 
&quot;$BBCodeAllow = &quot;yes&quot;;&quot;

I have $UBBCodeAllow = &quot;yes&quot;;
 
did you actually parse the form?

Like this:

read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $buffer);
foreach $pair (@pairs) {
local($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack(&quot;C&quot;, hex($1))/eg;
$value =~ s/<!--(.|\n)*-->//g;
$FORM{$name} = $value;
}
$UBBCodeAllow = $FORM{'UBBCodeAllow'};
$UBBCodeno = $FORM{'UBBCodeAllow'};


 
Are you sure that $UBBCodeAllow is getting set properly? You mentioned your &quot;variable file&quot;; are you &quot;require&quot;ing your variable file so it gets included in your program? What you are doing looks OK, so I guess we need more info. Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
It is not working... :-(

Here is what my variable file looks like:

%hash = (
---hash---
);
$UBBCodeAllow = &quot;yes&quot;;
1;


I sucessfully made these if things correctly before. But this time it's just not working right...
 
There's nothing I can see wrong with the if statement, nor with the way you are using the value of $UBBCodeyes and $UBBCodeno. If you have a require statement to inlude your variable file before you check the value of $UBBCodeAllow, then I can't see anything wrong with it. Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top