Reputation: 19242
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>
Upvotes: 0
Views: 315
Reputation: 771
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>
Upvotes: 0
Reputation: 5082
Give a name to the input:
<input type="submit" name="submit" value="submit" />
Upvotes: 3