Welcome Guest, Not a member yet? Register   Sign In
A PHP Error was encountered Severity: Notice Message: Undefined index:
#1

(This post was last modified: 03-06-2019, 07:25 AM by ciadmin. Edit Reason: Added code tags )

Hi I have a site which was previously built by someone we no longer deal with and whilst I have been able to sort many issues out one keeps getting my all twisted,

I have an area on my dashboard which allows me to add a file to upload a pdf

and when on the front end it gives me a clickable link.

I now need to add an extra PDF in the same format, so I have copied the code in the admin modules added it below the other PDF and changes the details as required  and have been able to make it appear in the dashboard it all works adds the file to the DB and puts it in the correct folder.

then I copied the relevant code for the front end change the details and the link appears but i get this error message.



A PHP Error was encountered
Severity: Notice
Message: Undefined index: acccesories_fitting_pdf_file
Filename: views/index.php
Line Number: 104

the code for this is

Code:
<?php
                }
                
                if(!empty($accessories[0]['accessories_fitting_pdf_file']))
                {
                    ?>
                    <div class="bullet-box-content">
                        <a href="<?php echo base_url(); ?>images/accessories_images/pdf/<?php echo $accessories[0]['acccesories_fitting_pdf_file']; ?>" target="_blank">Fitting Instructions</a>
                    </div>   

Which was a copy of this
<?php
                if(!empty($accessories[0]['accessories_pdf_file']))
                {
                ?>
                    <div class="bullet-box-content">
                        <a href="<?php echo base_url(); ?>images/accessories_images/pdf/<?php echo $accessories[0]['accessories_pdf_file']; ?>" target="_blank">View Drawing</a>
                    </div>


the complete index.php code is as follows

<div class="container-fluid">

<?php
if(!empty($accessories) && !empty($accessories[0]['accessories_banner_image']))
{
?>
    <div class="row">
        <div class="col-sm-12 pl0 pr0">
          <div class="product-banner-bg">
              <img src="<?php echo base_url(); ?>images/accessories_images/<?php echo $accessories[0]['accessories_banner_image']; ?>" alt="" title="" class="img-responsive"/>
            </div>        
        </div>
    </div>
<?php
}
?>

<div class="clearfix"></div>

<div class="container">
    <div class="row">
        <div class="col-sm-12">
            <div class="product-hd">Accessories</div>
            <div class="medium-hd"><?php echo $accessories[0]['accessories_name']; ?></div>
        </div>
    </div>
    <div class="row">
        <div class="col-sm-12">
            <div class="content">
                <?php echo html_entity_decode($accessories[0]['accessories_description']);

                /*<!--<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum ac libero vitae ligula fringilla sollicitudin non in lacus.
                Aliquam non nulla at nisi maximus pharetra id at sapien. Pellentesque ullamcorper imperdiet ex. Praesent eu finibus nisl, id viverra
                 mauris. Sed iaculis erat a dolor mattis eleifend. Integer dolor augue, fermentum sed mauris a, pretium ornare ligula. Fusce ut
                 orci sem. Curabitur sit amet neque sit amet erat scelerisque iaculis. </p>-->*/ ?>
            </div>
        </div>
    </div>
    
    <?php
    if(!empty($accessory_images) && count($accessory_images) > 0)
    {
    ?>
    <div class="row">
        <div class="col-sm-12">
            <div class="medium-hd"></div>
            <div class="content">
                <div id="links-install" class="links">
                    <?php
                    $accessory_img_cnt = 0;
                    
                    foreach($accessory_images as $acc_img)
                    {
                        $accessory_img_cnt = $accessory_img_cnt + 1;
                    ?>
                        <div class="col-sm-3 mt15 mb15 product-border">
                             <a href="<?php echo base_url(); ?>images/accessories_images/<?php echo $acc_img['accessories_image']; ?>" title="Accessory image <?php echo $accessory_img_cnt; ?>">
                            <img src="<?php echo base_url(); ?>images/accessories_images/<?php echo $acc_img['accessories_image']; ?>" alt="Accessory image <?php echo $accessory_img_cnt; ?>" class="img-responsive">
                            </a>
                        </div>
                    <?php
                    }
                    ?>
                </div>
            </div>
        </div>
    </div>
    <?php
    }
    ?>
    
    <?php
    if(!empty($accessories[0]['accessories_pdf_file']))
    {
    ?>
    
    <div class="row">
        <div class="col-sm-12">
            <div class="medium-hd"></div>
            <div class="content">
                <?php
                if(!empty($accessories[0]['accessories_pdf_file']))
                {
                ?>
                    <div class="bullet-box-content">
                        <a href="<?php echo base_url(); ?>images/accessories_images/pdf/<?php echo $accessories[0]['accessories_pdf_file']; ?>" target="_blank">View Drawing</a>
                    </div>
                <?php
                }
                
                if(!empty($accessories[0]['accessories_zip_file']))
                {
                    ?>
                    <div class="bullet-box-content">
                        <a href="<?php echo base_url(); ?>images/accessories_images/zip/<?php echo $accessories[0]['accessories_zip_file']; ?>" target="_blank">2D Drawings</a>
                    </div>
                <?php
                }
                
                if(!empty($accessories[0]['accessories_fitting_pdf_file']))
                {
                    ?>
                    <div class="bullet-box-content">
                        <a href="<?php echo base_url(); ?>images/accessories_images/pdf/<?php echo $accessories[0]['acccesories_fitting_pdf_file']; ?>" target="_blank">Fitting Instructions</a>
                    </div>    
                    <?php
                }
                ?>
                
            </div>
        </div>
    </div>
    
    <?php
    }
    ?>

</div>
<script>
    document.getElementById('links-install').onclick = function (event)
    {
        event = event || window.event;
        var target = event.target || event.srcElement,
            link = target.src ? target.parentNode : target,
            options = {index: link, event: event},
            links = this.getElementsByTagName('a');
            blueimp.Gallery(links, options);
    };
</script>


I have looked everywhere for a refernce but I am obviously missing something basic. please could someone help?
Reply


Messages In This Thread
A PHP Error was encountered Severity: Notice Message: Undefined index: - by trace1301t - 03-06-2019, 07:00 AM



Theme © iAndrew 2016 - Forum software by © MyBB