参见英文答案 >
What does an entry “action=’?’” in html form mean?6
我正在关注PHP MysqL新手到忍者:
我正在关注PHP MysqL新手到忍者:
下面的表单模板
<form action="?" method="post"> <div> <label for="joketext">Type your joke here:</label> <textarea id="joketext" name="joketext" rows="3" cols="40"></textarea> </div> <div><input type="submit" value="Add"></div> </form>
PHP控制器的一部分:
if(isset($_POST['joketext'])) //insert block { try { //prepared starement $sql = 'INSERT INTO joke SET joketext = :joketext,jokedate = CURDATE()';
“?”做表单动作