UBB.Dev
Posted By: havoq Pre Thread Titles Help - 04/23/2005 4:04 AM
This is adapted from LK's little mod found here
https://www.ubbdev.com/ubb/ultimatebb.php/topic/8/3801.html#000000

What Im trying to do is, if the user selects only two of these options, then it creates the thread title with the two chosen. However, the problem Im running into is, since I have 3 types, as seen below, if a user only selects two options, it still writes out the third.

For example it'll actually post this: [Roommate] blank1[Male]

So what I have is this for example: (public_new_topic_form.pl)

Code
if ($in{f} =~ m/^(7)$/) {
print qq~
<tr bgcolor="$vars_style{AltColumnColor1}">
<td nowrap="nowrap">
<font size="$vars_style{TextSize}" face="$vars_style{FontFace}"><b>
Message Type:
</b></font></td>
<td>
<input type="radio" name="type" value="" checked="checked" /> None
<input type="radio" name="type" value="[Roommate] " /> Roommate
<input type="radio" name="type" value="[Sublessor] " /> Sublessor
<input type="radio" name="type" value="[Apartment] " /> Apartment
<input type="radio" name="type" value="[House] " /> House

<input type="radio" name="type3" value="[Male] " /> Male
<input type="radio" name="type3" value="[Female] " /> Female

<select name="type2">
<option selected value="blank1">Please Choose</option>
<option value="['05] ">05</option>
<option value="[05-06] ">05-06</option>
<option value="['06] ">06</option>
<option value="[06-07] ">06-07</option>
</select>


</td>
</tr>
~;
}
and in ubb_new_topic.cgi:

Code
$in{topic_subject} = $in{type} . $in{type2} . $in{type3} . $in{topic_subject};
Posted By: havoq Re: Pre Thread Titles Help - 04/23/2005 4:20 PM
now its not even that so much Im having a problem with.

I want a : at the end of the thread title.

for example, Apartment 05/06 Male: (user inputs rest here)

However, I cant put :'s after each $in{type}, in ubb_new_topic cuz if a user selects all of those options, it will put 3 colons in.

I think I need some sort of if statment, err array?
Posted By: havoq Re: Pre Thread Titles Help - 04/24/2005 5:39 PM
n/m, figured it out by writing some if statements wink

Code
	if (($in{type}) && ($in{type2}) && ($in{type3})) {
$in{topic_subject} = $in{type} . " " . $in{type2} . " " . $in{type3}. ": " . $in{topic_subject};
}
elsif (($in{type}) && ($in{type2})) {
$in{topic_subject} = $in{type} . " " . $in{type2} . ": " . $in{topic_subject};
}
elsif (($in{type}) && ($in{type3})) {
$in{topic_subject} = $in{type} . " " . $in{type3} . ": " . $in{topic_subject};
}
elsif (($in{type2}) && ($in{type3})) {
$in{topic_subject} = $in{type2} . " " . $in{type3} . ": " . $in{topic_subject};
}

elsif ($in{type3}) {
$in{topic_subject} = $in{type3}. ": " . $in{topic_subject};
}
elsif ($in{type2}) {
$in{topic_subject} = $in{type2}. ": " . $in{topic_subject};
}
elsif ($in{type}) {
$in{topic_subject} = $in{type}. ": " . $in{topic_subject};
}
© UBB.Developers