Checkbox as images
-
I wanted to show check box as images so I made new tag for that it is working but when submit only send me one value not the multiple check box that I select.
here is the code please do tell what is wrong with it.
function add_shortcode_imagecheckbox() {
wpcf7_add_form_tag( ‘imagecheckbox’, ‘imagecheckbox_handler’, true );
}
add_action( ‘wpcf7_init’, ‘add_shortcode_imagecheckbox’ );function imagecheckbox_handler( $tag ){
$tag = new WPCF7_FormTag( $tag );$atts = array(
‘type’ => ‘checkbox’,
‘name’ => $tag->name,
‘list’ => $tag->name . ‘-options’ );$input = sprintf(
‘<input %s />’,
wpcf7_format_atts( $atts ) );
$datalist = ”;
$datalist .= ‘<div class=”imgcheckbox”>’;
foreach ( $tag->values as $val ) {
list($checkboxvalue,$imagepath) = explode(“!”, $val
);$datalist .= sprintf(
‘<label><input type=”checkbox” name=”%s” value=”%s” class=”hidecheckbox” /></label>’,
$tag->name,
$checkboxvalue, $imagepath
);}
$datalist .= ‘</div>’;return $datalist;
}
- The topic ‘Checkbox as images’ is closed to new replies.