sqlite3 - Calling out a form within a form (PHP) -
i'm trying call out form within form second form action not work. didn't parse. sample program have 1 main form attached submit button , inner form 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 multiple handler approach. i'm still not able call out download path. code download working single form.
as stated in the xhtml spec,
form: must not contain other form elements.
and if it's in spec, should not rely on how given user-agent vendor handles it. , in case aren't familiar how folks on there use phrases "must not", there's this:
must: in specification, word "must" interpreted mandatory requirement on implementation or on strictly conforming xhtml documents, depending upon context. term "shall" has same definition "must".
edit: curious, , found the html5 spec includes language forbidding nested forms.
edit (code suggestions):
method one: sibling-forms approach
<?php $fullpath = $_server['document_root']."/doc/store"."$t"; ?> <form id="staff" name="staff" method="post" action="gotonextpage.php"> <input type="submit" name="submit" value='submit'> </form> <form name="download" action="download.php" method="post">"; <input type="hidden" name="fullpath" value="<?php echo $fullpath ?>"/>"; <input type="submit" name="submit" value="download"/>"; </form>
method two: multi-purpose handler approach
<?php $fullpath = $_server['document_root']."/doc/store"."$t"; ?> <form id="staff" name="staff" method="post" action="downlod_or_gotonextpage.php"> <input type="submit" name="submit" value='submit'> <input type="hidden" name="fullpath" value="<?php echo $fullpath ?>"/>"; <input type="submit" name="submit" value="download"/>"; </form>
and make downlod_or_gotonextpage.php
switch($_post['submit']) { case "submit": // go next page, either 302, include, or whatever appropriate break; case "download": // downloading, perhaps 302 first... break; default: // 404, or 302 original form page }
Comments
Post a Comment