hi guyz,
pls help... what does this warning means??? is there any alternative for implode();?

Warning: implode() [function.implode]: Invalid arguments passed in /home/tjconsul/public_html/admin/actions/act_addcandidate1.php on line 40

It means that Invalid arguments were passed to the implode function on line 40 of the /home/tjconsul/public_html/admin/actions/act_addcandidate1.php file.

Show your code.

hi.. adam.adamski.96155
this my action pages code.

<?php

if($_SERVER['REQUEST_METHOD']=="POST"){
    $cnd_id             =  $_POST["cnd_id"];
    $title              =  $_POST['title'];
    $name               =  $_POST['name'];
    $surname            =  $_POST['surname'];
    $contact            =  $_POST['contact'];
    $email_id1          =  $_POST['email_id'];
    $loc_considered     =  $_POST['loc_considered'];
    $loc_considered1    =  implode(', ',$loc_considered);

    if($cnd_id>0){

    $sql="UPDATE tbl_candidate SET title = '".$title."', name='".$name."', surname = '".$surname."' , contact_phone ='".$contact."', email_id='".$email_id1."',location_considered = '".$loc_considered1."' WHERE cnd_id= $cnd_id";
     $obj->query($sql) or die(mysql_error());

     }else {  


        $emailCheck = mysql_query("SELECT email_id FROM tbl_candidate WHERE email_id = '".$email_id1."'");
        if (mysql_num_rows($emailCheck) > 0) {
        exit('<script type="text/javascript">alert("Email Address Already Exists - Please Try A Different One"); return false;  </script>');
        }


     $sql="INSERT INTO  tbl_candidate (title,name,surname,contact_phone,email_id,location_considered) VALUES ('$title','$name','$surname','$contact','$email_id1','$loc_considered1');
        $obj->query($sql) or die(mysql_error());

        }

        header("Location: ./candidatelist.php");
        exit();

?>

tnx in advnc

$loc_considered1 = implode(', ',$loc_considered); is the problem line.
implode() expects parameter one to be a string (which it is) and parameter two to be an array, which it probably isn't. Where is the form that produces the $_POST['loc_considered'] variable?
Can you post that code?

tnx... adam.adamski.96155
this is the code where it produce $_POST['loc_considered'];

<?php

 <tr> 
       <td>Location Considered </td>
       <td  align="left" colspan="2">
        <?php 
$loc_con1 = array(1=>'ALL','Andaman and Nicobar Islands','Andhra Pradesh', 'Arunachal Pradesh','Assam', 'Bihar','Chandigarh','Chhattisgarh','Dadra and Nagar Haveli','Daman and Diu','Delhi','Goa','Gujarat','Himachal Pradesh','Jammu and Kashmir','Jharkhand','Karnataka','Kerala','Lakshadweep','Madhya Pradesh', 'Maharashtra','Manipur','Meghalaya','Mizoram','Nagaland','Orissa','Pondicherry','Punjab','Rajasthan','Sikkim','Tamil Nadu','Tripura','Uttaranchal','Uttar Pradesh','West Bengal');

$i=0;


<select name="loc_considered[]" multiple="multiple">
<?php
for($j=1;$j<=(count($loc_con1)-0);$j++)
{

    if($loc_con1[$j]== $loc_con[$i])
    {

     echo '<option value="'.$loc_con1[$j].'" selected="selected">'.$loc_con1[$j].'</option>\n';
     $i++;
    }

    else
{
        echo '<option value="'.$loc_con1[$j].'">'.$loc_con1[$j].'</option>\n';
}
}
?>
</select>
        </td>
    </tr>
?>

Your code was hit by a train... on line 1, you open a php code block and you do not close it before inserting standard HTML:

<?php
<tr>
<td>Location Considered </td>
<td align="left" colspan="2">
<?php 

Then you open another PHP code block on line 6 without closing the first unneccessary code block (?>).
I could rewrite the code above to acheive your goal, but what would you learn?

Have a look here for an explanation of how to access the variables in the multiple select box (line 12).
Tidy your code, debug the value of $_POST when the action page loads (print_r($_POST); die();), and post your updated code if you still have problems.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.