skip to Main Content

Fatal error: Uncaught TypeError: implode(): Argument #2 ($array) must be of type ?array, string given in /home/——/imcartsend.php:25 Stack trace: #0 /home/_______/res/imcartsend.php(25): implode(‘;’, ‘Note’)
#1 {main} thrown in /home/________/imcartsend.php on line 25

on line 25

$imUserDataCSV = implode(";",$imUserDataCSVH) . "n" . implode(";",
$imUserDataCSV);

Gives me error this error the internet page, how can we edit new php8, how can we delete the error new line.
Thank you

$imUserDataCSV = implode($imUserDataCSVH ";") . "n" . implode($imUserDataCSVH ";"
);

always same error

2

Answers


  1. Chosen as BEST ANSWER

    Entered but it doesn't work, the problem is solved but then it doesn't automatically send e-mails

    <?php
        include "imemail.inc.php";
        
        //Load content
        $PayMsg = array("S.n.c. .............");
        $imOpt = 0;
        $imOrderNo = $_POST["imOrderNo"];
        $imLocale = explode("||",$_POST["imLocale"]);
        $imUserData = str_replace("'", "'", $_POST["imUserData"]);
        $imUserData = explode("||",$imUserData);
        $imUserDataTxt = "";
        $imUserDataHTML = "";
        $imUserDataCSVH = "";
        `$imUserDataCSV` = "";
        $i = 0;
        if(is_array($imUserData))
           foreach($imUserData as $ud) {
              $ud = explode("::",$ud);
              $imUserDataTxt .= $ud[0] . ": " . $ud[1] . "n";
              $imUserDataHTML .= "<tr" . ($i%2 ? " bgcolor="#EEEEEE"" : "") . "><td width="25%"><b>" . $ud[0] . ":</b></td><td>" . $ud[1] . "</td></tr>n";
              $imUserDataCSVH = $ud[0];
              $imUserDataCSV = $ud[1];
              $i++;
        }
        if (is_array($imUserDataCSVH) && is_array($imUserDataCSV)) {
            $imUserDataCSV = implode(";",$imUserDataCSVH) . "n" . implode(";",$imUserDataCSV);
        }
        
        
        $imOrderData = str_replace("'", "'", $_POST["imOrderData"]);
        $imOrderData = explode("||",$imOrderData);
        $imOrderDataTxt = "";
        $imOrderDataHTML = "";
        $imOrderDataCSV = "";
        $i = 0;
        if(is_array($imOrderData)) {
           foreach($imOrderData as $od) {
              $od = explode("::",$od);
              if(count($od) == 6)
                 $imOpt = 1;
           }
           $imOrderDataHTML = "<tr bgcolor="#EEEEEE"><td><b>" . $imLocale[1] . "</b></td><td><b>" . $imLocale[2] . "</b></td>" . ($imOpt ? "<td><b>" . $imLocale[3] . "</b></td>" : "") . "<td><b>" . $imLocale[4] . "</b></td><td><b>" . $imLocale[5] . "</b></td></tr>n";
           $imOrderDataCSV = $imLocale[0] . ";" . $imLocale[1] . ";" . ($imOpt ? $imLocale[2] . ";" : "") . $imLocale[3] . ";" . $imLocale[4] . ";" . $imLocale[5];
           foreach($imOrderData as $od) {
              $od = explode("::",$od);
              switch(count($od)) {
                 case 6:
                    $imOrderDataCSV .= "n" . implode(";",$od);
                    $imOrderDataTxt .= $od[0] . " - " . $od[1] . " - " . $od[2] . " " . $od[3] . " x " . $od[4] . " " . $od[5] . "n";
                    $imOrderDataHTML .= "<tr" . ($i%2 ? " bgcolor="#EEEEEE"" : "") . "><td>" . $od[0] . " - " . $od[1] . "</td><td>" . $od[2] . "</td><td>" . $od[3] . "</td><td>" . $od[4] . "</td><td>" . $od[5] . "</td></tr>n";
                    break;
                 case 5:
                    $imOrderDataCSV .= "n" . $od[0] . ";" . $od[1] . ";" . ($imOpt ? ";" : "") . $od[2] . ";" . $od[3] . ";" . $od[4];
                    $imOrderDataTxt .= $od[0] . " - " . $od[1] . " " . $od[2] . " x " . $od[3] . " " . $od[4] . "n";
                    $imOrderDataHTML .= "<tr" . ($i%2 ? " bgcolor="#EEEEEE"" : "") . "><td>" . $od[0] . " - " . $od[1] . "</td>" . ($imOpt ? "<td></td>" : "") . "<td>" . $od[2] . "</td><td>" . $od[3] . "</td><td>" . $od[4] . "</td></tr>n";
                    break;
                 case 2:
                    $imOrderDataCSV .= "n" . $od[0] . ";;;" . ($imOpt ? ";" : "") . ";" . $od[1];
                    $imOrderDataTxt .= $od[0] . ": " . $od[1] . "n";
                    $imOrderDataHTML .= "<tr" . ($i%2 ? " bgcolor="#EEEEEE"" : "") . "><td colspan="" . ($imOpt ? "4" : "3") . "">" . $od[0] . "</td><td>" . $od[1] . "</td></tr>n";
                    break;
              }
              $i++;
           }
           $imOrderDataHTML .= "</table>";
        }
        
        // Template
        $htmHead = "<table width="90%" border="0" bgcolor="#FFFFFF" cellpadding="4" style="font: 13px Tahoma; color: #000000; border: 1px solid #BBBBBB;">";
        $htmFoot .= "</table>";
        
        //Send email to owner
        $htmMsg = $htmHead . "<tr><td><b>" . $imOrderNo . "</b></td></tr>" . $htmFoot . "<br>" . $htmHead . $imOrderDataHTML . $htmFoot . "<br>" . $htmHead . $imUserDataHTML . $htmFoot . "<br>" . $htmHead . "<tr><td style="font-size: 85%"><div style="overflow: auto;">" . str_replace("n","<br>",$imOrderDataCSV) . "</div></td></tr>" . $htmFoot . "<br>" . $htmHead . "<tr><td style="font-size: 85%"><div style="overflow: auto;">" . str_replace("n","<br>",$imUserDataCSV) . "</div></td></tr>" . $htmFoot;
        $oEmail = new imEMail($_POST["imUserMail"],"[email protected]",$imOrderNo,"iso-8859-1");
        $oEmail->setText($imOrderNo . "nn" . $imOrderDataTxt . "nnn" . $imUserDataTxt . "nnn" . $imOrderDataCSV . "nn" . $imUserDataCSV);
        $oEmail->setHTML("<html><body bgcolor="#063A69" style="background-color: 
        #063A69"><center>" . $htmMsg . "</center></body></html>");
        $oEmail->send();
    
        //Send email to user
        $htmMsg = $htmHead . "<tr><td><b>" . $imOrderNo . "</b></td></tr><tr><td>" . str_replace("rn","<br>",$PayMsg[$_POST["imShipment"]]) . "</td></tr>" . $htmFoot . "<br>" . $htmHead . $imOrderDataHTML . $htmFoot . "<br>" . $htmHead . 
        $imUserDataHTML . $htmFoot;
        $oEmail = new imEMail("[email protected]",$_POST["imUserMail"],$imOrderNo,"iso-8859-1");
        $oEmail->setText($imOrderNo . "n" . $PayMsg[$_POST["imShipment"]] . "nn" . 
        $imOrderDataTxt . "nnn" . $imUserDataTxt);
        $oEmail->setHTML("<html><body bgcolor="#063A69" style="background-color: 
        #063A69"><center>" . $htmMsg . "</center></body></html>");
        $oEmail->send();
        @header("Location: ../impay.html");
    ?>
    

  2. You’re question doesn’t provide much information, but based on the error you can at least prevent it by doing the following:

    if (is_array($imUserDataCSVH) && is_array($imUserDataCSV)) {
        $imUserDataCSV = implode(";",$imUserDataCSVH) . "n" . implode(";",$imUserDataCSV);
    }
    

    implode requires an array, so the if statement checks that the variable $imUserDataCSVH is an array.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search