在這段代碼中,當使用Google doc文件生成表單時,我們希望單獨提交所有按鈕,但是這樣我們就會形成分離提交按鈕... .................................................. .................................................. .................................................. .................................................. .................................................. ************************************************** ************************************************** ************************************************** ************************************************** ***我該如何給出一個提交生成許多按鈕的表單提交的常見按鈕
$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>';
?>
給出一些細節
您需要添加更多的細節。是否所有按鈕都需要鏈接到相同的URL?他們都有相同的價值觀嗎?他們都需要提交相同的數據字段嗎?你有使用Javascript的選項嗎? –
你的問題並不是真的關於PHP。這是關於HTML的。 PHP恰好是您用來生成HTML的代碼,但您可以輕鬆地使用Ruby或Perl,或者直接編寫靜態HTML,並且問題也會適用。 –