Jump to content

[SOLVED] Invalid arguments passed


tomtom

Recommended Posts

Hey.

I've done this function a million times but today it went wrong! lol.

 

any ideas why?

code snippet below:

<?php
            $get_produc = mysql_query("SELECT * from `products`");
            while($product = mysql_fetch_array($get_produc)) {
                echo "
    <tr>
        <td><input type=\"checkbox\" name=\"products[]\" value=\"" . $product['id'] . "\""; if($product[rec]=="yes") { echo " checked disabled"; } echo ">" . $product['name'] . "</td>
    </tr>";
            }
echo "
</table>

</div>
<input type=\"submit\" name=\"installation\" class=\"sub\" value=\"Install\">
</form>
</div>";
        }else{
            $products = implode("/", $_POST[products]);
         }
?>

 

cheers :)

 

the error is: Warning: implode() [function.implode]: Invalid arguments passed in /home/deltamax/public_html/delta/updater.php on line 100

 

line 100 is $products = implode("/", $_POST[products]);

Link to comment
Share on other sites

Try now

 

<?php
            $get_produc = mysql_query("SELECT * from `products`");
            while($product = mysql_fetch_array($get_produc)) {
                echo "
    <tr>
        <td><input type=\"checkbox\" name=\"products[]\" value=\"" . $product['id'] . "\""; if($product['rec']=="yes") { echo " checked disabled"; } echo ">" . $product['name'] . "</td>
    </tr>";
            }
echo "
</table>

</div>
<input type=\"submit\" name=\"installation\" class=\"sub\" value=\"Install\">
</form>
</div>";
        }else{
            $products = implode("/", $_POST['products']);
         }
?>

Link to comment
Share on other sites

<?php
        if(!$_POST[installation]) {
            echo "
<div style=\"display: none;\" id=\"products\">
<div style=\"overflow: auto; height: 150;\";>
<form method=\"post\">
<table>";
            $get_produc = mysql_query("SELECT * from `products`");
            while($product = mysql_fetch_array($get_produc)) {
                echo "
    <tr>
        <td><input type=\"checkbox\" name=\"check[]\" value=\"" . $product['id'] . "\""; if($product['rec']=="yes") { echo " checked disabled"; } echo ">" . $product['name'] . "</td>
    </tr>";
            }
echo "
</table>

</div>
<input type=\"submit\" name=\"installation\" class=\"sub\" value=\"Install\">
</form>
</div>";
        }else{
            echo "<div id=\"install\"><center><img src=\"/delta/modules/ajax-loader.gif\"><br>
<b>Installing...</b> (May take a few minutes)</center></div>
<body onload=\"HideContent('install');\">";
            print_r($_POST['check']);
            $product = implode("/", $_POST['check']);
            // rest of code etc...
?>

 

But it can't be that it isn't submitting. As if I add another input field, that posts perfectly fine. And the form does submit. It just errors on the checkboxes :S

Link to comment
Share on other sites

I know what the problem is!!

 

Right. It was getting this error because there were NO values submitted. Ones which were like this...

<input type="checkbox" name="check[]" value="13" checked disabled>Icon manager

 

Did not submit any value

 

but normal ones withOUT checked or disabled and were ticked, did submit - therefore fixing the error.

 

It's the disabled that interferes. If it is set as disabled it sends nothing. Solved :)

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.