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
https://forums.phpfreaks.com/topic/117191-solved-invalid-arguments-passed/
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']);
         }
?>

<?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

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 :)

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.