如何在PHP中使用按钮或表单?
@foreach ($category as $cat)
{{$cat->id}}
{{$cat->title}}
so on..
@endforeach
始终显示错误。我想要做的是,如果有人点击按钮,结果就会显示出来。
答案 0 :(得分:2)
neme="1"
应为name="1"
<form>
标签echo $rwo->id;
查看结果isset
来避免未定义的索引通知type="submit"
代替type="button"
<form>
<button formmethod="GET" name="1" type="submit">click</button>
</form>
<?php
if (isset($_GET["1"])) {
require_once "0000.php";
$query = mysql_query("SELECT * FROM op");
while ($rwo = mysql_fetch_object($query)) {
echo $rwo->id;
}
}
?>