Support » Plugins » How to register array of values -<input name=”myvalue[]”>

  • Can anyone tell me?
    I want to have on Settins page few fields with the same name:

    <input name=”myvalue[]”>
    <input name=”myvalue[]”>

    How to register, how to load values?

Viewing 1 replies (of 1 total)
  • I know this post is a month old, but maybe you or someone else is still looking…

    add_action( 'admin_init', 'myRegisterFunction' );
    function myRegisterFunction() {
    	register_setting( 'my-setting-group', 'my_serialized_setting' );

    You can access the values with get_option, it will be an array if you do use the form options with the value names as arrays…

    $options = array();
    $options = get_option( "my_serialized_setting" );
    // Print the array
    // Print each value of array
    foreach ($options as $value) {
    	echo $value;
Viewing 1 replies (of 1 total)
  • The topic ‘How to register array of values -<input name=”myvalue[]”>’ is closed to new replies.