wordpress - Cant get php to work inside shortcode content -
i tried several solutions looking @ similar questions within site won't work me. =( please help.
this excerpt original code:
<form action="" method="get"> <input type="text" name="search" value=""> <input type="submit" value="search"> <?php echo do_shortcode('[expand] <input type="checkbox" name="title" <?php if(isset($_get['title'])) echo "checked='checked'"; ?>> <label for="ti">title</label></td> [/expand]'); ?> </form> basically, want checkboxes remain checked, if checked before hitting submit. unfortunately, it's been hours , can't php work inside shortcode.
please help.
your can try this,
<form action="" method="get"> <input type="text" name="search" value=""> <input type="submit" value="search"> <?php $check=isset($_get['title']) ? "checked='checked'" : ''; echo do_shortcode('[expand] <input type="checkbox" name="title" '.$check.' ><label for="ti">title</label></td> <input type="submit" value="search"> [/expand]'); ?> </form>
Comments
Post a Comment