I have this code in test.php
.
For some reason, even when I click submit, I don't get the message that it's posting. Anyone can explain why? and how can I get it to work.
<body>
<form action="" method="post">
<input type="text" id="inp" />
<input type="submit" value="submit" />
</form>
<?php
if (isset($_POST['submit'])) {
echo "posting";
}
?>
</body>
给输入一个名字:
<input type="submit" name="submit" value="submit" />
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
echo "posting";
}
Try this:
<body>
<form action="" method="post">
<input type="text" id="inp" />
<input type='hidden' name='submit' value=''>
<input type="submit" value="submit" />
</form>
<?php
if (isset($_POST['submit'])) {
echo "posting";
}
?>
</body>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.