WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Add checkbox to save page (4 posts)

  1. ironman95
    Member
    Posted 1 year ago #

    Hey guys,

    I'm building my own WordPress theme and have a question.
    I want to save the value of a checkbox. Currently I have only text boxes.

    function manager_admin_menu() {

    if(isset($_GET['page']) && $_GET['page'] == 'test') {

    if(isset($_POST['action']) && $_POST['action'] == 'save') {

    $pics= array();

    foreach($_POST['src'] as $k => $v) {
    $pics[] = array(
    'src' => $v,
    'link' => $_POST['link'][$k],
    'caption' => $_POST['caption'][$k]
    );
    }

    update_option('pics', $pics);

  2. esmi
    Forum Moderator
    Posted 1 year ago #

    What's this for? You really should not be using $_GET - especially without some sort of data checks. It's terribly insecure.

  3. LastForOne
    Member
    Posted 1 year ago #

    have look at this tutorial @ wp.tutsplus

  4. ironman95
    Member
    Posted 1 year ago #

    @LastForOne Thank you. That's what I was looking for.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.