Jump to content

Php pdf form showing "array" for drop down menus


Recommended Posts

Hello I have an issue with a form that has been built by someone else on Wordpress. 

using contact form 7 plugin there's a for to fill out and it emails a PDF copy to the customer.

however on the pdf any information from dropdown selections shows "Array" instead of what was selected, everything looks fine to me (with my very minimal knowledge of PHP) the title & Preferred Payment Method:  doesn't show on the pdf 

here is the contact form 7 code.


 

<div class="steps">
    <div class="step gap-large step-1">
        <h2 class="step-title"><span class="gold">Step 1.</span> Calculate the value of your <span class="gold">gold</span></h2>
        [gold_calculator your-items]    
    </div>
    <div class="step gap-large step-2">
        <h2 class="step-title"><span class="gold">Step 2.</span> Submit your details</h2>
        <div class="row">
            <div class="column col-xs-12 col-sm-2 col-lg-4">
                <label class="required" for="sell-title">Title</label>
                [select* your-title id:sell-title class:form-control "Mr" "Mrs" "Miss" "Ms"]
            </div>
            <div class="column col-first-name col-xs-12 col-sm-5 col-lg-4">
                <label class="required" for="sell-first-name">First Name</label>
                [text* your-first-name id:sell-first-name class:form-control placeholder "Enter your first name"]
            </div>
            <div class="column col-last-name col-xs-12 col-sm-5 col-lg-4">
                <label class="required" for="sell-last-name">Last Name</label>
                [text* your-last-name id:sell-last-name class:form-control placeholder "Enter your last name"]
            </div>
            <div class="column col-xs-12 col-sm-12 col-lg-4">
                <label class="required" for="sell-email">Email Address</label>
                [email* your-email id:sell-email class:form-control placeholder "Enter your email address"]
            </div>
            <div class="column col-xs-12 col-sm-6 col-lg-4">
                <label class="required" for="sell-daytime-phone">Daytime Telephone</label>
                [tel* your-daytime-phone id:sell-daytime-phone class:form-control placeholder "Enter your telephone number"]
            </div>
            <div class="column col-xs-12 col-sm-6 col-lg-4">
                <label class="" for="sell-mobile-phone">Mobile Telephone</label>
                [tel your-mobile-phone id:sell-mobile-phone class:form-control placeholder "Enter your mobile number"]
            </div>
            <div class="column col-xs-12 col-sm-6 col-lg-6">
                <label class="required" for="sell-address-1">Address Line 1</label>
                [text* your-address-1 id:sell-address-1 class:form-control placeholder "Enter your address"]
            </div>
            <div class="column col-xs-12 col-sm-6 col-lg-6">
                <label class="" for="sell-address-2">Address Line 2</label>
                [text your-address-2 id:sell-address-2 class:form-control placeholder "Enter your address"]
            </div>
            <div class="column col-xs-12 col-sm-12 col-lg-4">
                <label class="required" for="sell-city">Town/City</label>
                [text* your-city id:sell-city class:form-control placeholder "Enter your town/city"]
            </div>
            <div class="column col-xs-12 col-sm-6 col-lg-4">
                <label class="required" for="sell-county">County</label>
                [text* your-county id:sell-county class:form-control placeholder "Enter your county"]
            </div>
            <div class="column col-xs-12 col-sm-6 col-lg-4">
                <label class="required" for="sell-postcode">Postcode</label>
                [text* your-postcode id:sell-postcode class:form-control placeholder "Enter your postcode"]
            </div>
            <div class="column col-xs-12 col-sm-12 col-lg-6">
                <label class="required" for="sell-method">Choose your method of payment</label>
                [select* your-method id:sell-method class:form-control "Instant Bank Transfer" "Cash" "Cheque"]
            </div>
            <div class="column col-xs-12 ccol-sm-12 col-lg-6">
                <div class="input-label required">Terms &amp; Conditions</div>
                [acceptance your-price-acceptance id:sell-price-acceptance]I accept the price offered above for my gold.[/acceptance]
                [acceptance your-terms-acceptance id:sell-terms-acceptance]I accept the <a href="/terms-conditions/" target="_blank">terms &amp; conditions</a>.[/acceptance]
                [acceptance your-acknowledgement id:sell-acknowledgement]I declare and acknowledge that: 1. I confirm the property enclosed is mine to sell, 2. I believe the items(s) to be genuine gold or platinum 3. You will contact me if the value calculated upon receipt differs in weight or carat 4. I accept payment will only be made to the person named on the submission form.[/acceptance]
            </div>
            <div class="column col-submit col-xs-12 col-sm-12">
                <div class="alert alert-info">After clicking the ‘Submit’ button below, we'll email you a form to print off and include with the package you send to us. If you wish to be paid by bank transfer, please write your bank details on the form once printed.</div>
                <div class="submit">[submit class:btn class:btn-gold "Submit"]</div>
            </div>
        </div>
    </div>
</div>






here is the pdf php form code. 

 

<?php /** @var \Strive\Sections\Pdf_Form $this */ ?>
<head>
    <style>
        h1, h2 {
            margin-top: 0;
        }

        th, td {
            text-align: left;
            vertical-align: top;
        }

        .section {
            padding: 20px 0;
        }

        .border-top {
            border-top: solid 1px #E7E7E7;
        }

        .cut-top {
            border-top: dashed 1px #E7E7E7;
        }

        .text-placeholder {
            background-color: #F7F7F7;
        }

        .cut-note {
            text-align: center;
            font-size: 80%;
            margin-bottom: 5px;
        }
    </style>
</head>
<body>
<h1>Step 3. Print &amp; post this form with your gold</h1>
<div class="section quote border-top">
    <h2 class="section-title">Customer Quote:</h2>
    <div>
        <?php if ( $this->calculator['empty'] 😞 ?>
            <p>You didn't weigh your gold - don't worry, we'll do it for you and call you with an offer. </p>
        <?php else: ?>
            <ol>
                <?php foreach ( $this->calculator['items'] as $item 😞 ?>
                    <li><?php echo $item['weight']; ?>g of <?php echo $item['name']; ?> -
                        &pound;<?php echo $item['price']; ?></li>
                <?php endforeach; ?>
            </ol>
            <p>Total: &pound;<?php echo $this->calculator['total']; ?></p>
        <?php endif; ?>
    </div>
</div>
<div class="section details border-top">
    <h2 class="section-title">Customer Details:</h2>
    <table width="100%">
        <tr>
            <td width="50%">
                <table width="100%">
                    <tr>
                        <th>Reference:</th>
                        <td><?php echo $this->reference; ?></td>
                    </tr>
                    <tr>
                        <th>Name:</th>
                        <td></td><?php echo empty( $this->title ) ? '' : $this->title; ?>
                            <?php echo empty( $this->first_name ) ? '' : $this->first_name; ?>
                            <?php echo empty( $this->last_name ) ? '' : $this->last_name; ?></td>
                    </tr>
                    <tr>
                        <th>Email:</th>
                        <td><?php echo empty( $this->email ) ? '-' : $this->email; ?></td>
                    </tr>
                    <tr>
                        <th>Telephone:</th>
                        <td><?php echo empty( $this->daytime_phone ) ? '-' : $this->daytime_phone; ?></td>
                    </tr>
                    <tr>
                        <th>Mobile:</th>
                        <td><?php echo empty( $this->mobile_phone ) ? '-' : $this->mobile_phone; ?></td>
                    </tr>
                </table>
            </td>
            <td width="50%">
                <table width="100%">
                    <tr>
                        <th>Address 1:</th>
                        <td><?php echo empty( $this->address_1 ) ? '' : $this->address_1; ?></td>
                    </tr>
                    <tr>
                        <th>Address 2:</th>
                        <td><?php echo empty( $this->address_2 ) ? '' : $this->address_2; ?></td>
                    </tr>
                    <tr>
                        <th>Town/City:</th>
                        <td><?php echo empty( $this->city ) ? '' : $this->city; ?></td>
                    </tr>
                    <tr>
                        <th>County:</th>
                        <td><?php echo empty( $this->county ) ? '' : $this->county; ?></td>
                    </tr>
                    <tr>
                        <th>Postcode:</th>
                        <td><?php echo empty( $this->postcode ) ? '' : $this->postcode; ?></td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
</div>
<div class="section payment border-top">
    <p>Preferred Payment Method: <?php echo empty( $this->method ) ? '' : $this->method; ?></p>
    <?php if ( $this->method === 'Instant Bank Transfer' 😞 ?>
        <p>Write down your bank details below for the account in which you wish funds to be deposited.</p>
        <table width="100%">
            <tr>
                <th width="25%">Bank:</th>
                <td width="75%" class="text-placeholder">&nbsp;</td>
            </tr>
            <tr>
                <th>Name on Account:</th>
                <td width="75%" class="text-placeholder">&nbsp;</td>
            </tr>
            <tr>
                <th>Sort Code:</th>
                <td width="75%" class="text-placeholder">&nbsp;</td>
            </tr>
            <tr>
                <th>Account No:</th>
                <td width="75%" class="text-placeholder">&nbsp;</td>
            </tr>
        </table>
    <?php endif; ?>
</div>
<div class="cut-note">Print this form, include the above part in your package and post to the address below.</div>
<div class="section address cut-top">
    <p>
        SMG<br><br>
        <?php echo empty( $this->send_address ) ? '' : $this->send_address ?>
    </p>
</div>
</body>

 

 

 

any help would be appreciated. 

Edited by Barand
code tags added
Link to comment
Share on other sites

There's a lot of code involved in this form and email process that you aren't posting so it's going to be very hard to identify where the problem is.

So generic answer: check the documentation for the form stuff to make sure you're using it correctly. Because "Array" means that the value was an array, but none of those values ought to be arrays.

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.