I’m trying to call out a form within a form where the second form action does not work. It didn’t parse. My sample program have one main form which is attached to my submit button and inner form would be a download button.
Updated code:
<?php
$fullPath = "staff.doc";
<form id="Staff" name="Staff" method="post" action="download_preview.php">
echo "<input type=\"hidden\" name=\"fullPath\" value=\"$fullPath\"/>";
echo "<input type=\"submit\" name=\"submit\" value=\"Download\"/>";
echo "<input type=\"submit\" id=\"Submit\" name=\"Submit\" value\="Submit\"/>";
echo "</form>";
<?php
switch($_POST['submit'])
{
case "Submit":
break;
case "Download":
$fullPath = $_POST['fullPath'];
// download file
opendir("$fullPath");
break;
default:
}
?>
I have updated with the multiple handler approach. But i’m still not able to call out the download path. The code for the download was working previously with a single form.
As stated in the XHTML spec,
And if it’s in the spec, you should not rely on how any given user-agent vendor handles it. And just in case you aren’t familiar with how the folks over there use phrases like "must not", there’s this:
EDIT: I was curious, and found that the HTML5 spec also includes language forbidding nested forms.
EDIT (code suggestions):
method one: the sibling-forms approach
method two: the multi-purpose handler approach
And then make downlod_or_gotonextpage.php