简体   繁体   English

复选框值未获取->注意:未定义的索引:第27行的C:\\ wamp \\ www \\ crud_exer1 \\ content.php中的name1

[英]checkbox value not get -> Notice: Undefined index: name1 in C:\wamp\www\crud_exer1\content.php on line 27

I'm trying to do multiple deletion with checkboxes.. But as a test, I tried to get the values of the first two checkboxes but it's not working.. I did: 我正在尝试使用复选框进行多次删除。。但是,作为测试,我尝试获取前两个复选框的值,但是它不起作用。

<td> <input type="checkbox"  name=" <?php echo $name[$pos]; ?> " value="<?php echo $row["id"]; ?>" /> </td>

to display records first when the page loads then at the top, I did the following to print the name of the first 2 checkboxes as well as print the value of the 1st checkbox: 为了在页面加载时首先显示记录,然后在页面顶部显示,我执行了以下操作以打印前两个复选框的名称以及第一个复选框的值:

elseif(isset($_POST["delete"])){
        echo $name[0];
        echo $name[1];
        $value_of_box =  $_POST["$name[0]"];
        echo $value_of_box;
    }

but only the name of the checkboxes are recognized since it prints 但仅复选框的名称可以识别,因为它可以打印

name1name2 名称1名称2

but I'm getting this error: " 但我收到此错误:

Notice: Undefined index: name1 in C:\\wamp\\www\\crud_exer1\\content.php on line 27 注意:第27行的C:\\ wamp \\ www \\ crud_exer1 \\ content.php中的未定义索引:name1

" when it comes to printing the value of the checkbox.. I thought that if it recognized the name of the box, it should also recognized the value, right? WHAT'S WRONG WITH THIS? “当涉及到打印复选框的值时。我以为,如果它识别了复选框的名称,那么它也应该识别该值,对吗?这是什么地方错了?

Now I get it! 现在我懂了! Must use same name for the checkboxes like: 复选框必须使用相同的名称,例如:

checkbox_name[] checkbox_name []

rather than using an array there .. ^_^ 而不是在那里使用数组.. ^ _ ^

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 注意:未定义的索引:第63行的C:\\ wamp \\ www \\ chatsystem \\ index.php中的名称 - Notice: Undefined index: name in C:\wamp\www\chatsystem\index.php on line 63 注意:未定义的索引:在第37行的C:\\ wamp \\ www \\ tests \\ Joomla \\ Website \\ index.php中 - Notice: Undefined index: in C:\wamp\www\tests\Joomla\Website\index.php on line 37 注意:未定义的索引:第46行的C:\\ wamp \\ www \\ upload.php中的fileToUpload - Notice: Undefined index: fileToUpload in C:\wamp\www\upload.php on line 46 注意:未定义的索引:第164行的C:\\ wamp \\ www \\ blog \\ news.php中的pre - Notice: Undefined index: pre in C:\wamp\www\blog\news.php on line 164 注意:未定义的变量:第7行的C:\\ wamp \\ www \\ cbmall \\ index.php中的db_host - Notice: Undefined variable: db_host in C:\wamp\www\cbmall\index.php on line 7 我有错误:注意:未定义偏移量:C:\\ wamp \\ www \\ index.php在32行,34行,36行,38行的C:\\ wamp \\ www \\ index.php中 - I have error:Notice: Undefined offset: 1 in C:\wamp\www\index.php on line 32,on line 34,on line 36,on line 38 PHP错误提示:未定义的索引:第35行的C:\\ wamp \\ www \\ tweetball \\ classes \\ word.class.php中的UserID - Php error Notice: Undefined index: UserID in C:\wamp\www\tweetball\classes\word.class.php on line 35 未定义索引:第 4 行 C:\wamp\www\emailvalidate.php 中的电子邮件 - Undefined index: email in C:\wamp\www\emailvalidate.php on line 4 注意:未定义的索引:第16行的F:\\ wamp64 \\ www \\ practise \\ insert.php中的用户名 - Notice: Undefined index: username in F:\wamp64\www\practise\insert.php on line 16 注意:未定义的索引:第21行的D:\\ wamp \\ www \\ onlinesShop \\ newitem.php中的图像 - Notice: Undefined index: image in D:\wamp\www\onlinesShop\newitem.php on line 21
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM