1

I have created an associative array, based on a variables i already initalised. The idea is to output the items in the array to an html table. I have the table populating and working fine, except for one small issue - if the user returns a NULL value for $aid, the html control below is still clickable.

$User[] = array('acc_id' => $acc_id, 
                'uid' => $uid, 
                'fname' => $fname, 
                'lname' => $lname, 
                'gender' => $gender, 
                'utype' => $utype, 
                'isArt' => $isArt, 
                'isAct' => $isAct, 
                'cont' => "<p class='buttons is-right'>
                               <a href='artistadmin.php?performer=**$aid**' class='button is-small'>
                                   <span class='icon'>
                                       <i class='fas fa-crown'></i>
                                   </span>
                               </a>
                               <a href='useradmin.php?account=$acc_id' class='button is-small'>
                                   <span class='icon'>
                                       <i class='fas fa-edit'></i>
                                   </span>
                               </a>
                               <a class='button is-small is-danger'>
                                   <span class='icon'>
                                       <i class='fas fa-trash-alt'></i>
                                   </span>
                               </a>
                           </p>");

I was looking for a way to disable this? The table is being populated by a nested foreach statement also.

Any advice would be great

1 Answer 1

4

You can use (empty($aid)? '' : '<your html code here>') in your array

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.