我点击提交按钮后没有写入文件

时间:2016-04-07 22:22:00

标签: php forms submit isset

 <?php
 if(isset($_POST['submit_btn']))
 /////code here//////
 /////the program actually gets inside this if statement after the user submits login info

 if(strpos(file_get_contents("accounts.txt"),$text) !== false) : ?>

 /////html form displays here...and the submit button name of the form is submitbtn//////
<input type="submit" name="submitbtn" value="Submit" onclick="giveaway()">

 <?php endif; ?>    

 <?php
 if(isset($_POST['submitbtn']))
 //////the content here never runs, regardless if I click submit or not/////

有没有人知道为什么当我点击表单的提交按钮时,php代码在它运行之后?它永远不会进入if语句

1 个答案:

答案 0 :(得分:0)

错字:submit_btnsubmitbtn

<?php
 if(isset($_POST['submitbtn']))
 /////code here//////
 /////the program actually gets inside this if statement after the user submits login info

 if(strpos(file_get_contents("accounts.txt"),$text) !== false) : ?>

 /////html form displays here...and the submit button name of the form is submitbtn//////
<input type="submit" name="submitbtn" value="Submit" onclick="giveaway()">

 <?php endif; ?>    

 <?php
 if(isset($_POST['submitbtn']))
 //////the content here never runs, regardless if I click submit or not/////