Jquery Form过程由PHP案例切换并验证动态字段

时间:2013-10-28 17:47:52

标签: php jquery forms

我使用这个脚本:

    switch($id) {

                //Username and real name need the same validation, so only need one case block here
                case "titel":
                case "graad":
                case "info":
                case "youtube":
                    //Ensure that they are both at least 6 characters long
                    if (strlen($value) < 6) {
                        //To make it more readable, replace the "-"'s with spaces and make the first character upper case
                        $msg = str_replace("-", " ", ucfirst($id)) . " moet minimaal 6 karakters lang zijn.";
                    }
                    break;
                case "personen":
                case "duur":
                    //Use PHP filter to validate the E-Mail address
                    if (!ctype_digit($value)) {
                        $msg = str_replace("-", " ", ucfirst($id)) . " mag alleen uit cijfers bestaan.";
                    }
                    break;
                default:

                        $msg = "";

                    break;
            }

我使用名为:nodig []的动态表单字段和字段aantal []。问题是输入字段是由id。

呈现的

如何将动态字段输入交换机?

网站的格式为:http://www.rolfvandamme.nl/beta/(点击橙色按钮)。

抱歉我的英语不好。

1 个答案:

答案 0 :(得分:0)

您可以通过这种方式从文本框中获取值:

<input type="text" name="array[]" />
<input type="text" name="array[]" />
<input type="text" name="array[]" />

$textbox_values_array = $_POST['array'];