Welcome Guest, Not a member yet? Register   Sign In
Need help with Arrays
#1

[eluser]bdegier[/eluser]
Hello,

I am trying to make someone elses code (which is pretty dirty, i will clean up when i get this working Smile) work.

The code is meant to send some data over a SOAP connection and there are a few vars which are arrays. The code parses these values just fine and the soap envelope looks like this:
Code:
<width>1</width>
<height>1</height>
<weight>1</weight>
<package>Array</package>

Now, all these variables (width, height etc.) are Arrays. Everything works besides the packaging. Somehow it just spells "Array" instead of pushing the right vars in.

I have no clue what to do. Here's my code:

Controller: Shipping.php
Code:
&lt;?php

class Shipping extends Controller {

    function Shipping() {
        parent::Controller();    
    }
    
    function index() {
        $this->load->view('register');
    }
    
    function step1() {
        $sender = array(
            'company' => $this->input->post('create_user_company'),
            'department' => $this->input->post('create_user_department'),
            'address1' => $this->input->post('create_user_address1'),
            'streetnumber' => $this->input->post('create_user_street_number'),
            'address2' => $this->input->post('create_user_address2'),
            'zipCode' => $this->input->post('create_user_zipCode'),
            'city' => $this->input->post('create_user_city'),
            'state' => $this->input->post('create_user_state'),
            'country' => $this->input->post('create_user_countrycode'),
            'phone' => $this->input->post('create_user_phone'),
            'email' => $this->input->post('create_user_email'),
            'fax' => $this->input->post('create_user_fax'),
            'vatnumber' => $this->input->post('create_user_vatnumber'),
            'cocnumber' => $this->input->post('create_user_cocnumber')
            );
            $this->load->view('addShipment', $sender);
    }
    
    function step2() {
        $data = array(
            'senderReferentie' => $this->input->post('sender_referentie'),
            'senderCompany' => $this->input->post('sender_company'),
            'senderDepartment' => $this->input->post('sender_department'),
            'senderAddress1' => $this->input->post('sender_address1'),
            'senderTitle' => $this->input->post('sender_title'),
            'senderName' => $this->input->post('sender_name'),
            'senderSurname' => $this->input->post('sender_surname'),
            'senderStreetnumber' => $this->input->post('sender_street_number'),
            'senderAddress2' => $this->input->post('sender_address2'),
            'senderZipcode' => $this->input->post('sender_zipCode'),
            'senderCity' => $this->input->post('sender_city'),
            'senderState' => $this->input->post('sender_state'),
            'senderCountry' => $this->input->post('sender_countrycode'),
            'senderPhone' => $this->input->post('sender_phone'),
            'senderEmail' => $this->input->post('sender_email'),
            // Sender
            'receiverReferentie' => $this->input->post('receiver_referentie'),
            'receiverCompany' => $this->input->post('receiver_company'),
            'receiverDepartment' => $this->input->post('receiver_department'),
            'receiverAddress1' => $this->input->post('receiver_address1'),
            'receiverTitle' => $this->input->post('receiver_title'),
            'receiverName' => $this->input->post('receiver_name'),
            'receiverSurname' => $this->input->post('receiver_surname'),
            'receiverStreetnumber' => $this->input->post('receiver_street_number'),
            'receiverAddress2' => $this->input->post('receiver_address2'),
            'receiverzipCode' => $this->input->post('receiver_zipCode'),
            'receiverCity' => $this->input->post('receiver_city'),
            'receiverState' => $this->input->post('receiver_state'),
            'receiverCountry' => $this->input->post('receiver_countrycode'),
            'receiverPhone' => $this->input->post('receiver_phone'),
            'receiverEmail' => $this->input->post('receiver_email'),
            // Items
            'itemColli' => $this->input->post('item_colli'),
            'itemPackage' => $this->input->post('item_package'),
            'itemWeight' => $this->input->post('item_weight'),
            'itemLength' => $this->input->post('item_length'),
            'itemWidth' => $this->input->post('item_width'),
            'itemHeight' => $this->input->post('item_height'),
            'itemDescription' => $this->input->post('item_description'),
            // Shipment
            'shipmentDescription' => $this->input->post('shipment_description'),      
            'shipmentInsurance' => $this->input->post('shipment_insurance'),
            'shipmentInsuredvalue' => $this->input->post('shipment_insuredvalue'),
            'shipmentCod' => $this->input->post('shipment_cod')
        );
        $this->load->view('compareResult', $data);
    }
}
?&gt;

The remaining code doesn't fit in here. It's up here:
View: addShipment.php
http://pastie.org/787933
View: compareResult.php
http://pastie.org/787934


I also have the old procedural PHP code which works just fine if you want it. (the above code was based on this old code, just converted into OO/MVC).
#2

[eluser]bdegier[/eluser]
Got it fixed with some help on IRC Smile




Theme © iAndrew 2016 - Forum software by © MyBB