Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/353.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Google应用程序引擎处理html表单post数组_Python_Google App Engine - Fatal编程技术网

Python Google应用程序引擎处理html表单post数组

Python Google应用程序引擎处理html表单post数组,python,google-app-engine,Python,Google App Engine,我的HTML代码如下所示: <INPUT type="text" name="txt[]"> <INPUT type="checkbox" name="chk[]"/> 我通过以下方式获得PHP中的值: <?php $chkbox = $_POST['chk']; $txtbox = $_POST['txt']; foreach($txtbox as $a => $b) echo "$chkbox[$a] - $txtbox[$a] <b

我的HTML代码如下所示:

<INPUT type="text" name="txt[]">
<INPUT type="checkbox" name="chk[]"/>

我通过以下方式获得PHP中的值:

<?php
$chkbox = $_POST['chk'];
$txtbox = $_POST['txt'];

foreach($txtbox as $a => $b)
  echo "$chkbox[$a]  -  $txtbox[$a] <br />";
?>


如何使用Python在Google App Engine中获得价值?

在Python中不需要这种技巧。例如,您可以有许多同名字段:

<INPUT type="text" name="txt">
<INPUT type="text" name="txt">
<INPUT type="text" name="txt">

<INPUT type="checkbox" name="chk">
<INPUT type="checkbox" name="chk">
<INPUT type="checkbox" name="chk">

好的,我想我不应该在html中添加数组。我已经搜索了一段时间了,现在,我建议编辑这个问题,以便更容易搜索/找到它。我在appengine room与一位杰出人士进行了IRC聊天,才将我与这个问题联系起来。很好,以下是相关文档:
txt = self.request.POST.getall('txt')
chk = self.request.POST.getall('chk')

for txt_value, chk_value in zip(txt, chk):
    print '%s - %s<br />' % (txt_value, chk_value)