I have a parent form which “saves” the settings and changes user puts. But I also have a logo upload form inside the parent form.
When I try to upload the logo and submit my upload it seems that my form does not process anything. If i put the upload form outside the parent form, it works.
I can’t process forms which are under forms in php? :S
<form action="" method="post">
....
My upload form:
<form id="file-form" enctype="multipart/form-data" action="<?php echo $_SERVER['REQUEST_URI']; ?>" method="POST">
<label for="async-upload">Upload</label>
<input type="file" id="async-upload" name="async-upload"> <input type="submit" value="Upload" name="html-upload">
<?php wp_nonce_field('client-file-upload'); ?>
<input type="hidden" name="redirect_to" value="<?php echo $_SERVER['REQUEST_URI']; ?>" />
</form>
</form>
Does not work.
<form id="file-form" enctype="multipart/form-data" action="<?php echo $_SERVER['REQUEST_URI']; ?>" method="POST">
<label for="async-upload">Upload</label>
<input type="file" id="async-upload" name="async-upload"> <input type="submit" value="Upload" name="html-upload">
<?php wp_nonce_field('client-file-upload'); ?>
<input type="hidden" name="redirect_to" value="<?php echo $_SERVER['REQUEST_URI']; ?>" />
</form>
<form>
...
</form>
works.
Why?
Form elements may not be nested: