When you've got your shortcodes defined like this:
[myform]
Foo: [mytextbox name="foo"]
[/myform]
And in your php:
function shortcode_myform($atts, $content = null) {
return '<form action="#" method="post">' . do_shortcode($content) . '</form>';
}
add_shortcode('myform','shortcode_myform');
function shortcode_mytextbox($atts) {
return '<input type="text" name="'$atts['name']'" />';
}
add_shortcode('mytextbox','shortcode_mytextbox');
What would be the most elegant way to get the name
attribute of any children of myform
attribute inside the shortcode_myform
function?
I figured I could use sessions or globals but that doesn't feel like the right thing to do.