pixeltrace Posted July 5, 2007 Share Posted July 5, 2007 guys, i need help. how can i fix this error? Warning: implode() [function.implode]: Bad arguments. in /var/www/html/myoochi/findit/propertyfindit.php on line 16 this is the page http://mango.resonance.com.sg/myoochi/findit/propertyfindit.php?address=kampong%20ampat&postal= how can i fix the code for my implode? currently if i didnt select anything in the checkbox, especially if i get went to the page i will get this error, but once i get to the "Consumer Specific R" tab and select anything there, the error will be gone. below is my codes for this page <? $poitype = implode(",", $_GET['poitype']); ?> <table width="417" border="0" cellspacing="0" cellpadding="0"> <form action="" method="get"> <tr> <td width="168" valign="top"> <input name="poitype[]" type="checkbox" value="9CCARE,9FLSCH,9JC,9KG,9PRI,9SEC,9SCARE,9TI"> <span class="style2">Education for Children</span><br> <input name="poitype[]" type="checkbox" value="8FBAC,8OSBAC,8RBAC,8ACUMB,9ATM,8FBANK,8OBANK,8RBANK,8DBUMB"> <span class="style2">Financial Services</span><br> <input name="poitype[]" type="checkbox" value="9RCLUB"> <span class="style2">Recreation</span><br> </td> <td width="187"> <input name="poitype[]" type="checkbox" value="19BDPT"> <span class="style2">Bus Deport/ Bus Park</span><br> <input name="poitype[]" type="checkbox" value="MRT"> <span class="style2">MRT Station</span><br> <input name="poitype[]" type="checkbox" value="9MOS,9SHTEM,9CHNTE,9INDTE,"> <span class="style2">Places of Worship</span><br> </td> </tr> <tr> <td colspan="2" valign="top"><input type="submit" name="Submit2" value="Submit"></td> </tr> </form> </table> <? echo "$poitype"; ?> hope you could help me with this. thanks! Link to comment https://forums.phpfreaks.com/topic/58496-solved-help-on-implode/ Share on other sites More sharing options...
teng84 Posted July 5, 2007 Share Posted July 5, 2007 implode are are good for array only mayebe what you need is explode to turn string itno array Link to comment https://forums.phpfreaks.com/topic/58496-solved-help-on-implode/#findComment-290116 Share on other sites More sharing options...
pixeltrace Posted July 5, 2007 Author Share Posted July 5, 2007 how do i do it? sorry im still not very familiar with implode and explode thanks! Link to comment https://forums.phpfreaks.com/topic/58496-solved-help-on-implode/#findComment-290128 Share on other sites More sharing options...
teng84 Posted July 5, 2007 Share Posted July 5, 2007 explode($_GET['poitype']); // array is the output may i know where is this declared poitype Link to comment https://forums.phpfreaks.com/topic/58496-solved-help-on-implode/#findComment-290130 Share on other sites More sharing options...
sasa Posted July 5, 2007 Share Posted July 5, 2007 change $poitype = implode(",", $_GET['poitype']); to if(isset($_GET['poitype']) and count($_GET['poitype']) > 0) $poitype = implode(",", $_GET['poitype']); Link to comment https://forums.phpfreaks.com/topic/58496-solved-help-on-implode/#findComment-290148 Share on other sites More sharing options...
teng84 Posted July 5, 2007 Share Posted July 5, 2007 change $poitype = implode(",", $_GET['poitype']); to if(isset($_GET['poitype']) and count($_GET['poitype']) > 0) $poitype = implode(",", $_GET['poitype']); cool but what if <0 Link to comment https://forums.phpfreaks.com/topic/58496-solved-help-on-implode/#findComment-290151 Share on other sites More sharing options...
pixeltrace Posted July 5, 2007 Author Share Posted July 5, 2007 hi, i replaced it as instructed $poitype = implode(",", $_GET['poitype']); to if(isset($_GET['poitype']) and count($_GET['poitype']) > 0) $poitype = implode(",", $_GET['poitype']); know i am getting errors on this line Notice: Undefined variable: poitype in /var/www/html/myoochi/findit/propertyfindit.php on line 435 the code on this line is this <? echo "$poitype"; ?> whatelse should be done here? thanks! Link to comment https://forums.phpfreaks.com/topic/58496-solved-help-on-implode/#findComment-290157 Share on other sites More sharing options...
AndyB Posted July 5, 2007 Share Posted July 5, 2007 Unless I'm misreading your original code poitype is an array - that's how you define them in your form. $_GET['poitype'] shouldn't return anything as you have no variable named $poitype, only array elements $poitype[0], $poitype[1] etc. Link to comment https://forums.phpfreaks.com/topic/58496-solved-help-on-implode/#findComment-290159 Share on other sites More sharing options...
pixeltrace Posted July 5, 2007 Author Share Posted July 5, 2007 i see. thanks! Link to comment https://forums.phpfreaks.com/topic/58496-solved-help-on-implode/#findComment-290161 Share on other sites More sharing options...
sasa Posted July 5, 2007 Share Posted July 5, 2007 change if(isset($_GET['poitype']) and count($_GET['poitype']) > 0) $poitype = implode(",", $_GET['poitype']); to if(isset($_GET['poitype']) and count($_GET['poitype']) > 0) $poitype = implode(",", $_GET['poitype']); else $poitype = 'Nothing selected! '; Link to comment https://forums.phpfreaks.com/topic/58496-solved-help-on-implode/#findComment-290162 Share on other sites More sharing options...
pixeltrace Posted July 5, 2007 Author Share Posted July 5, 2007 thanks! everything is ok now! Link to comment https://forums.phpfreaks.com/topic/58496-solved-help-on-implode/#findComment-290240 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.