www.webdeveloper.com
Results 1 to 3 of 3

Thread: activate and deactivate a mysql table record using a checkbox or link

Hybrid View

  1. #1
    Join Date
    Apr 2012
    Posts
    48

    activate and deactivate a mysql table record using a checkbox or link

    Hi

    Sorry to ask for help again, have tried looking last night for this little issue

    I want to have a link or checkbox in the backend admin that shows or hides the table record from the front end but on the backend it shows as active or deactive and is easy for the admin user to make it active and deactive by clicking a checkbox or link

    Or same thing but archives the table record to a archive database and then the admin user can move it back from the archive database to the main database

    Is either ways possible, could someone point me in the right direction or send a link that could help me get started

    Kind regards

    Ian

  2. #2
    Join Date
    Apr 2012
    Posts
    48
    Hi

    I have managed to get the active field entered in the mySQL database using the SET type and entering active and inactive in the values part and managed to get the two radio buttons displayed in the php page but can't work out how to make the record inactive when click the inactive radio button

    The php code is below if it helps

    PHP Code:
    $active$row['active']; 
    PHP Code:
    echo "<td><input type='radio' name='a'.$active . value='active'>Active <input type='radio' name='a'.$id . value='inactive'>Inactive"."</td>"

  3. #3
    Join Date
    Sep 2013
    Posts
    221
    You should treat it as an array like this,

    <input name="checkbox[]" type="checkbox" value="<?php echo $row['link_id']; ?>">

    Then only, you can take its count and loop it for activation or deletion.

    or can try out with the below one:
    <input type="checkbox" <?php echo ($condition) ? ' disabled="deletion"' : '';/>
    <input type="checkbox" <?php echo ($condition) ? ' enabled="activation"' : '';/>

    hope this helps.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles