在此代码中,当Google文档文件用于生成表单时,我们希望为所有人提供单独的提交按钮,但是有了这个,我们形成了单独的提交按钮............***********************************************************************************************************************************************************************************************************
$url='https://docs.google.com/xxxxxxxxxxxxxxxxxx';
$cat ='';
if (($handle = fopen($url, "r")) !== FALSE)
{
while (($data = fgetcsv($handle, 1000, ",")) !== FALSE)
{
$totalrows = count($data);
for ($row=0; $row<=$totalrows; $row++)
{
if (($row % 6 == 0) && (strlen($data[$row])>0))
{
$answer = $row + 1;
$response["status"] = 1;
$response["price"] = $data[$answer+4];
$prodname = explode(' ',$response["prodname"]);
$prodname = $prodname[0];
if($_COOKIE[$prodname]) { $quantity = $_COOKIE[$prodname]; } else { $quantity = "0"; }
if($response["subcat"] != 'Sub Category')
{
if($cat != $response["subcat"]){
echo '</div>';
echo '<div data-role="collapsible" data-collapsed-icon="arrow-r" data-expanded-icon="arrow-d" data-content-theme="c">';
echo '<h3>'.$response["subcat"].'</h3>';
echo '<div class="ui-grid-a"><div class="ui-block- a">'.$response["prodname"].' ('.$response["prodnamemarathi"].') - '.$response["quantity"].'<br/>Available in '.$month.'<br/>MRP: Rs.'.$response["price"].'</div>
<div class="ui-block-b">
<form action="?user='.$user.'" method="post"><input type="number" name="quantity" data-mini="true" value="'.$quantity.'" />
<input type="hidden" name="subcat" value="'.$response["subcat"].'">
<input type="hidden" name="price" value="'.$response["price"].'">
<input type="submit" value="Submit"></form></div></div>';
$cat = $response["subcat"];
}
else {
echo '<br/><div class="ui-grid-a"><div class="ui-block- a">'.$response["prodname"].' ('.$response["prodnamemarathi"].') - '.$response["quantity"].'<br/>Available in '.$month.'<br/>MRP: Rs.'.$response["price"].'</div>
<div class="ui-block-b">
<form action="?user='.$user.'" method="post"><input type="number" name="quantity" data-mini="true" value="'.$quantity.'"/><input type="hidden" name="subcat" value="'.$response["subcat"].'">
<input type="hidden" name="prodname" value="'.$response["prodname"].'">
<input type="hidden" name="prodnamemarathi" value="'.$response["prodnamemarathi"].'">
<input type="hidden" name="price" value="'.$response["price"].'">
<input type="submit" value="Submit">
</form></div></div>';
}
}
}
}
}
fclose($handle);
}
echo '</div>';
?>
提供一些细节
生成表单一次,只需将文本输入放入循环中即可。为它们指定一个数组样式的名称。
<form action="page2" method="post">
<?php
while ($i <= 5):
?> <input type="text" name="size[]">
<?php endwhile; ?>
<input type="submit" name="submit" value="Review Order">
</form>
在 page2
中,您可以将$_POST['size']
作为数组访问,该数组将包含所有输入。