le007 Posted October 17, 2007 Share Posted October 17, 2007 <tr> <td align="left"> <font size=2 face="arial" color="#65066"><b>Bedrooms</b></font> </td> <td align="left"> <select name="numberofrooms"> HERE; include("select/numrooms.inc.php"); echo <<<HERE </select></td> </tr> Above is my code - what I'd like is: if proptype == whatever then NOT to include the bedroom select option but enter a value of 1 for it. Something like this (but its not working at present) <tr> HERE; if ($property_type == "Agricultural Land" || $property_type == "Business" || $property_type == "Cafe/Deli" || $property_type == "Commerical Site" || $property_type == "Development Site" || $property_type =="Farm Land" || $property_type == "Franchises" || $property_type == "Garage" || $property_type == "Health and Beauty" || $property_type == "Hotels/B+Bs" || $property_type == "Industrial Unit" || $property_type == "Investment" || $property_type == "Licensed Premises" || $property_type == "New Developments" || $property_type == "Office Share" || $property_type == "Office Unit" || $property_type == "Parking Space"){ echo ""; }else if ($property_type == "Public House" || $property_type == "Retail Unit" || $property_type == "Shops" || $property_type == "Supermarkets" || $property_type == "Warehouse Unit"){ echo "<input type='hidden' name='numberofrooms' value='1'>"; } else { echo "<td align='left'>"; echo "<font size=2 face='arial' color='#650066'><b>Bedrooms</b></font>"; echo "</td>"; echo "<td align='left'>"; echo "<select name='numberofrooms'>"; include("select/numrooms.inc.php"); echo "</select></td>"; } ECHO <<<HERE </tr> Quote Link to comment https://forums.phpfreaks.com/topic/73575-solved-simple-question-for-someone/ Share on other sites More sharing options...
MadTechie Posted October 17, 2007 Share Posted October 17, 2007 i'm not sure what your asking for but .. maybe.. <?php if(!empty($property_type)) { echo "<input type='hidden' name='numberofrooms' value='1'>"; } else { echo "<td align='left'>"; echo "<font size=2 face='arial' color='#650066'><b>Bedrooms</b></font>"; echo "</td>"; echo "<td align='left'>"; echo "<select name='numberofrooms'>"; include("select/numrooms.inc.php"); echo "</select></td>"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/73575-solved-simple-question-for-someone/#findComment-371201 Share on other sites More sharing options...
le007 Posted October 17, 2007 Author Share Posted October 17, 2007 Thanks for the reply Its a long story - kinda complicated but basically if the $prop_type equals any of the given types eg Agricultural land or Business etc to EXCLUDE bedrooms - otherwise it'll be a residential edit meaning that bedrooms will have to be an option. (hope that makes sense) Quote Link to comment https://forums.phpfreaks.com/topic/73575-solved-simple-question-for-someone/#findComment-371204 Share on other sites More sharing options...
MadTechie Posted October 17, 2007 Share Posted October 17, 2007 you mean this ? *re-formatted <?php if( $property_type == "Agricultural Land" || $property_type == "Business" || $property_type == "Cafe/Deli" || $property_type == "Commerical Site" || $property_type == "Development Site" || $property_type =="Farm Land" || $property_type == "Franchises" || $property_type == "Garage" || $property_type == "Health and Beauty" || $property_type == "Hotels/B+Bs" || $property_type == "Industrial Unit" || $property_type == "Investment" || $property_type == "Licensed Premises" || $property_type == "New Developments" || $property_type == "Office Share" || $property_type == "Office Unit" || $property_type == "Parking Space") { echo "<input type='hidden' name='numberofrooms' value='1'>"; }elseif( $property_type == "Public House" || $property_type == "Retail Unit" || $property_type == "Shops" || $property_type == "Supermarkets" || $property_type == "Warehouse Unit") { echo "<td align='left'>"; echo "<font size=2 face='arial' color='#650066'><b>Bedrooms</b></font>"; echo "</td>"; echo "<td align='left'>"; echo "<select name='numberofrooms'>"; include("select/numrooms.inc.php"); echo "</select></td>"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/73575-solved-simple-question-for-someone/#findComment-371215 Share on other sites More sharing options...
le007 Posted October 17, 2007 Author Share Posted October 17, 2007 Yes but instead of the elseif can I not just put an else or does if have a limit to how many OR's are available? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/73575-solved-simple-question-for-someone/#findComment-371220 Share on other sites More sharing options...
MadTechie Posted October 17, 2007 Share Posted October 17, 2007 you could have else.. remember i am not 100% sure of the logic you want.. to be truful the formatting is the key.. Quote Link to comment https://forums.phpfreaks.com/topic/73575-solved-simple-question-for-someone/#findComment-371229 Share on other sites More sharing options...
le007 Posted October 17, 2007 Author Share Posted October 17, 2007 Topman MadTechie - you've saved me a LOT of hassle! It worked! Quote Link to comment https://forums.phpfreaks.com/topic/73575-solved-simple-question-for-someone/#findComment-371230 Share on other sites More sharing options...
MadTechie Posted October 17, 2007 Share Posted October 17, 2007 Coool, Quote Link to comment https://forums.phpfreaks.com/topic/73575-solved-simple-question-for-someone/#findComment-371232 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.