Jump to content

[SOLVED] help on implode


pixeltrace

Recommended Posts

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
Share on other sites

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
Share on other sites

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.