递归形式值&;将它们合并&;将它们发送到另一个页面


Retrive form values & combine them & send them to another page

当页面被重定向时,我想将文本框和单选按钮的值组合起来,并将其传递给文件.php。当带有扩展名的文件名被发送到file.php时,它会在文件夹中创建文件,并让用户下载(仅用于描述)
我有一种不好的感觉,我的代码有一些严重的问题。我不知道如何检索表单值,然后组合它们。很明显,这段代码出现了错误。需要帮助来理解错误并修复它。

<?php
<form name="np_form"  method="post" >   
File Name:
<input type="text" name="n" class="bar"/> <br/>
Choose Extension:  
<input type="radio" name="file"  value=".doc">.doc <br/>
<input type="radio" name="file"  value=".ppt">.ppt <br/> 
<input type="submit" name="submit" value="Create & Download" onclick="return  validation()" formaction="file.php?$filename=form['np_form']['n'].form['np_form']['file']" /> 
</form>
?>

我得到的错误:

分析错误:语法错误,意外的"np_form"(T_STRING),应为","或";"在第8行上的C:''examplep''htdocs''sss''inside_box_EFN.php中

---谢谢。希望你们能理解我的问题。

你没有回显html页面,朋友,这就是你出现错误的原因。此外,您可以在表单标记中使用ACTION属性,而不是使用提交的属性。

<?php
echo   '<form name="np_form"  method="POST" Action="file.php" >   
File Name:
<input type="text" name="n" class="bar"/> <br/>
Choose Extension:  
<input type="radio" name="file"  value=".doc">.doc <br/>
<input type="radio" name="file"  value=".ppt">.ppt <br/> 
<input type="submit" name="submit" value="Create & Download" onclick="return    
 validation()" /> 
</form>';
?>