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

  1. Sascha
    Posted 3 years 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 3 years 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
    Posted 3 years ago #

    have look at this tutorial @ wp.tutsplus

  4. Sascha
    Posted 3 years ago #

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

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.