开发者

php how to attach a if statement to a button?

I have a I statement;

if($game_set->issue_challenge()){echo "test";}else {"test failed";}

and I have a button:

<input type="submit" name="submit" id="submit" value="Submit" />

I want to be able to say: if the button isset, then $values = $_POST['gamelist'] and if($game_set->issue_challenge()){echo开发者_JAVA百科 "test";}else {"test failed";}

I was thinking something like

if (isset($_POST['Submit'])) {
$values = $_POST['gamelist']
if($game_set->issue_challenge()){echo "test";}else {"test failed";}
}

any ideas?

thanks


Assuming you're on a POST form:

if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    if (isset($_POST['submit']) && ($_POST['submit'] == 'Submit')) {
       ... it was clicked
    }
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜