简体   繁体   English

PHP $ _POST不起作用

[英]PHP $_POST does not work

foreach( $stmt as $row )
{

    echo "<tr>";
    echo "<td><button type=button' disabled id='NameButton' name='NameButton' value='".$row['Name']."'>".$row['Name']."</button></td>";
    echo "<td>" .$row['Level'] . "</td>";
    //echo "<td>" .$row[''] ."</td>";
    echo "<td>" .$row['FirstName'] . " " .$row['LastName']. "</td>";
    echo "<td> <button id='editClass' name='editClass' value='".$row['ID']."'>რედაქტირება</button>  </td>";
    echo "<td> <button id='deleteClass'>წაშლა</button>   </td>";    
    echo "</tr>";

}

This is my code for displaying from DB . 这是我从DB显示的代码。 now I try to do edit for, and i need to get 2 values from this form (1 => Name , 2 => Button [with ID from DB] ) for Button it works fine ( i post date ) , but for button with value from DB Post does not work 现在我尝试进行编辑,并且我需要从此form (1 => Name , 2 => Button [with ID from DB] )获取2个值form (1 => Name , 2 => Button [with ID from DB] )对于Button来说,它可以正常工作( i post date ) ,但是对于带有DB Post中的值不起作用

$ID     =$_POST['editClass'];
$name   =$_POST['NameButton'];
$date=array(":ID"=>$ID ,":Name"=>$name);
var_dump($date);`

this is how i try to get date ... output for var_dump is : 这就是我尝试获取日期的方式... var_dump的输出是:

array (size=2)
:ID' => string '132' (length=3)
:Name' => null

The button will not be submitted and it isn't designed for send data like inputs. 该按钮将不会提交,并且不适用于发送输入之类的数据。 Change the button tag for an input with submit's type. 更改具有提交类型的输入的按钮标签。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM