• i try to write very simple widget, everything was fine, yeah fine, it running well but when i put some code only for testing

    print_r($_POST); it show nothing on widget control panel, and i try to echo $_POST[‘zoaw_pisc_title’];, it way show empty but update always successful, i don’t know what happen here?

    function zoaw_postinsamecategory_control() {
    	$options = $newoptions = get_option('zoaw_postinsamecategory');
    
    	if ( $_POST['zoaw_pisc_submit'] ) {
    		$newoptions['title'] = strip_tags(stripslashes($_POST['zoaw_pisc_title']));
    print_r($_POST);
    echo $_POST['zoaw_pisc_title'];
    	}
    print_r($_POST);
    	if ( $options != $newoptions ) {
    		$options = $newoptions;
    		update_option('zoaw_postinsamecategory', $options);
    	}
    
    	$zoaw_title = attribute_escape($options['title']);
    
    	?>
    	<p>
    		<label><?php _e('Title:'); ?></label>
    		<input style="width: 200px;" name="zoaw_pisc_title" type="text" value="<?php echo $zoaw_title; ?>" />
    	</p>
    	<input type="hidden" name="zoaw_pisc_submit" value="1" />
    	<?php
    }
Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter nhtin

    (@nhtin)

    noone know this?

    sorry? where did you post the widget on?

    i have the same problem now!

    my action calls:


    add_action ('widgets_init', array('satpress_widgets','init'));

    //in the init function:

    $widget = new Sprw();
    register_widget_control ('sprw_control', array($widget,'sprw_control'), 350, 200);

    // in the sprw_control function:

    ...
    print_r($options);

    //is correct

    print_r($_POST);

    gives an empty array.

    sorry, the first line has to be:

    add_action (‘widgets_init’, array(‘Sprw’,’init’));

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘widget problem’ is closed to new replies.