有没有一个PhP函数可以计算传递给另一个函数的参数数量?例如
function tobeCounted ("numberOne","numberTwo","numberThree")
{
//do something with the parameters
}
一个函数将计算传递给上面的函数的参数数量,然后返回三个或参数的索引或参数本身。
我有一个包含订购表单的页面,在这个表单上它列出了供应商的信息,然后在产品下面和前面的供应商的每个产品是一个输入字段,允许用户输入他们想要的每种产品的数量。提交信息后,转到确认页面,在那里我需要能够显示订单信息。在订单页面的表单上,我有一个隐藏字段,其中包含供应商id。并且为每个供应商放置一次供应商id。我需要做的不仅是回显数量,而且回显出每个订单的供应商id。我的代码如下。第一个块是订单页面,然后下面的块是确认页面。因为它现在站在每个数量下面,它显示了所有的供应商ids,而不仅仅是我需要的一个。
<?php defined('C5_EXECUTE') or die(
在下面的代码中,我选择一个数量,然后检查我所选择的数量项目,然后单击add按钮提交表单。
<form name="addtocart" method="post" action="checkbox.php">
//foreach loop below loops through array of items fetched from the db
<?php foreach($result2 as $row) { ?>
<select name="qty">
<?php for ($
all_product.php ->列出所有产品
show>显示添加到购物车中的项目。
每次单击时,都会将其添加到数组中,并将它们全部列出。结果将类似于下面的(在使用in_array() )之前
Products that are added to cart, ID -> 4
Products that are added to cart, ID -> 7
Products that are added to cart, ID -> 6
Products that are added to cart, ID -> 5
Products that are ad
我正在尝试处理一个表单,但我事先不知道表单域是什么。这在PHP中还能做到吗?
例如,我有这样一个html表单:
<form method="post" action="process.php">
<?php get_dynamic_fields(); // this gets all the fields from DB which I don't know ahead of time what they are. ?>
<input type="submit" name="sub