我一直在想办法如何解决这个问题,但我似乎无法做到。我是PHP的初学者,我现在迷路了。我想对所选复选框的值求和,并在PHP页面中发布值的总和。
这是我的HTML到目前为止
<input class="wrapped-input" type="checkbox" value="290" id="widgetu15650_input" name="custom_U15293[]" tabindex="1"/>
<label for="widgetu15650_input"></label>
到目前为止我的PHP
if (isset($_POST['u15175'])) {
if($_POST){
$val = 0;
foreach($_POST['custom_U15293'] as $custom_U15293){
$val += $custom_U15293;
}
echo $val;
}
}
答案 0 :(得分:0)
试试这个,
@Entity // This tells Hibernate to make a table out of this class
public class Hand {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Integer id;
private int p1;
private String p1s;
private int p2;
private String p2s;
private int d1;
private String d1s;
private int trials;
private int score;
public Hand() {
}
如果您看到 if($_POST){
if(isset($_POST['custom_U15293']){
$val = 0;
foreach($_POST['custom_U15293'] as $custom_U15293){
$val += (int) $custom_U15293;
}
echo $val;
} else {
echo 'Value not received';
}
HTML代码存在问题