php - html中的按钮单击和php没有响应
问题描述
这是按钮<button type='submit' name="myBtn" id="myBtn" class="btn btn-primary ml-5">Match</button>
这是PHP中应该触发的部分
<?php
if(isset($_POST['myBtn']))
{
echo "in";
$q=mysqli_query($con,"SELECT id FROM members1 WHERE name='$username'");
$conv=$q->fetch_assoc();
$id=(int)$conv['id'];
$res=mysqli_query($con,"SELECT * FROM interests WHERE perId='$id'");
$row=mysqli_num_rows($res);
$c=0;
foreach ($_GET['interests'] as $selectedOption)
$c=$c+1;
$result=($c/$row)*100;
echo $result;
}
?>
另外,如果有人能告诉我如何将我在 $q 中收到的 id 转换为整数,我将不胜感激。我不认为我所做的是正确的。
初学者在这里,提前谢谢。
解决方案
推荐阅读
- angular - 无法访问 Angular 的 data-* 属性
- javascript - 如何将输入值添加到 npm 模块
- python - 在 Python 中将带小数的字符串的一部分转换为 Int
- c# - MVC:客户端添加/删除/编辑列表
模型属性 - azure - Limit node resources given to an Azure Batch job or task
- node.js - 如何在没有警告的情况下在 Ubuntu 上初始化 react-native 项目?
- r - data.table 连接的连接子句中更健壮的表达式?
- r - 如何对R中的函数求和?
- html - 使用 Laravel Dompdf 在 A4 大小页面的中心添加水平线
- mongoose - 使用 findOneAndUpdate 时如何访问更新和选项部分?