0

I'm getting the above referenced notices, which prevent from seeing/enter values in certain WP fields. The responses here available to similar problems are not working in my case. Thanks in advance for any help in correcting this issues.

Here is one of the lines noted as problematic:

<td class="forminp"><input name="<?php echo $value['id'] ?>" id="<?php echo $value['id'] ?>" type="<?php echo $value['type'] ?>" style="<?php echo $value['css'] ?>" value="<?php echo $results->$value['id'] ?>" <?php if ($value['req']) { ?> class="required <?php if (!empty($value['altclass'])) echo $value['altclass'] ?>" <?php } ?><?php if ($value['min']) ?> minlength="<?php echo $value['min'] ?>" <?php if($value['id'] == 'field_name') { ?>readonly="readonly"<?php } ?> /><br /><small><?php echo $value['desc'] ?></small></td>

And here is the complete code:

if ( !isset($results->field_type) ) $field_type = ''; else $field_type = $results->field_type;
      if ( !isset($results->field_perm) ) $field_perm = ''; else $field_perm = $results->field_perm;

      switch($value['type']) {

        case 'title':
        ?>

            <thead>
                <tr>
                    <th scope="col" width="200px"><?php echo $value['name'] ?></th><th scope="col">&nbsp;</th>
                </tr>
            </thead>

        <?php

        break;

        case 'text':

        ?>

       <tr id="<?php echo $value['id'] ?>_row" <?php if ($value['vis'] == '0') echo ' style="display:none;"'; ?>>
                <td class="titledesc"><?php if ($value['tip']) { ?><a href="#" tip="<?php echo $value['tip'] ?>" tabindex="99"><div class="helpico"></div></a><?php } ?><?php echo $value['name'] ?>:</td>
                <td class="forminp"><input name="<?php echo $value['id'] ?>" id="<?php echo $value['id'] ?>" type="<?php echo $value['type'] ?>" style="<?php echo $value['css'] ?>" value="<?php echo $results->$value['id'] ?>" <?php if ($value['req']) { ?> class="required <?php if (!empty($value['altclass'])) echo $value['altclass'] ?>" <?php } ?><?php if ($value['min']) ?> minlength="<?php echo $value['min'] ?>" <?php if($value['id'] == 'field_name') { ?>readonly="readonly"<?php } ?> /><br /><small><?php echo $value['desc'] ?></small></td>
            </tr>

        <?php

        break;

        case 'select':

        ?>

           <tr id="<?php echo $value['id'] ?>_row">
               <td class="titledesc"><?php if ($value['tip']) { ?><a href="#" tip="<?php echo $value['tip'] ?>" tabindex="99"><div class="helpico"></div></a><?php } ?><?php echo $value['name'] ?>:</td>
               <td class="forminp"><select <?php if ($value['js']) echo $value['js']; ?> <?php if(($field_perm == 1) || ($field_perm == 2)) { ?>DISABLED<?php } ?> name="<?php echo $value['id'] ?>" id="<?php echo $value['id'] ?>" style="<?php echo $value['css'] ?>">

                   <?php foreach ( $value['options'] as $key => $val ) { ?>

                         <option value="<?php echo $key ?>"<?php if (isset($results->$value['id']) && $results->$value['id'] == $key) { ?> selected="selected" <?php $field_type_out = $field_type; } ?>><?php echo $val; ?></option>

                   <?php } ?>

                   </select><br />
                   <small><?php echo $value['desc'] ?></small>

                   <?php
                   // have to submit this field as a hidden value if perms are 1 or 2 since the DISABLED option won't pass anything into the $_POST
                   if ( ($field_perm == 1) || ($field_perm == 2) ) { ?><input type="hidden" name="<?php echo $value['id'] ?>" value="<?php echo $field_type_out; ?>" /><?php } ?>

               </td>
           </tr>

        <?php

        break;

        case 'textarea':

        ?>

           <tr id="<?php echo $value['id'] ?>_row"<?php if($value['id'] == 'field_values') { ?> style="display: none;" <?php } ?>>
               <td class="titledesc"><?php if ($value['tip']) { ?><a href="#" tip="<?php echo $value['tip'] ?>" tabindex="99"><div class="helpico"></div></a><?php } ?><?php echo $value['name'] ?>:</td>
               <td class="forminp"><textarea <?php if((($field_perm == 1) || ($field_perm == 2)) && ($value['id'] != 'field_tooltip') && $value['id'] != 'field_values') { ?>readonly="readonly"<?php } ?> name="<?php echo $value['id']?>" id="<?php echo $value['id'] ?>" style="<?php echo $value['css'] ?>"><?php echo $results->$value['id'] ?></textarea>
                   <br /><small><?php echo $value['desc'] ?></small></td>
           </tr>

        <?php

        break;

        case 'checkbox':
        ?>

            <tr id="<?php echo $value['id'] ?>_row">
                <td class="titledesc"><?php if ($value['tip']) { ?><a href="#" tip="<?php echo $value['tip'] ?>" tabindex="99"><div class="helpico"></div></a><?php } ?><?php echo $value['name'] ?>:</td>
                <td class="forminp"><input type="checkbox" name="<?php echo $value['id'] ?>" id="<?php echo $value['id'] ?>" value="1" style="<?php echo $value['css']?>" <?php if($results->$value['id']) { ?>checked="checked"<?php } ?> />
                    <br /><small><?php echo $value['desc'] ?></small>
                </td>
            </tr>

        <?php
        break;

        case 'cat_checklist':

        ?>

           <tr id="<?php echo $value['id'] ?>_row">
               <td class="titledesc"><?php if ($value['tip']) { ?><a href="#" tip="<?php echo $value['tip'] ?>" tabindex="99"><div class="helpico"></div></a><?php } ?><?php echo $value['name'] ?>:</td>
               <td class="forminp">
                   <div id="categorydiv">
                       <div class="tabs-panel" id="categories-all" style="<?php echo $value['css'] ?>">
                           <ul class="list:category categorychecklist form-no-clear" id="categorychecklist">

                               <?php echo cp_category_checklist( unserialize($results->form_cats),(cp_exclude_cats($results->id)) ); ?>

                           </ul>
                       </div>
                   </div>
                   <br /><small><?php echo $value['desc'] ?></small>
               </td>
           </tr>

        <?php

        break;


    } // end switch

  } // end $results

} // endforeach
Avec
  • 3
  • 2
  • You are attempting to treat an array as a string, e.g. `echo $some_array_value`. Don't do this. The notice helpfully tells you exactly which line the problem occurs on, which should make it easy to find. – miken32 Mar 19 '21 at 19:56
  • And is `$value['id'] ?>` really something you mean to do? Seems unlikely. – miken32 Mar 19 '21 at 19:57

0 Answers0