Reputation: 7576
For some reason nothing happens when a user click on my submit button. The html look like this:
<td colspan="3">
<div align="center">
<input name="Decline" id="Decline" value="Decline" type="submit">
|
<input name="Accept" value="Accept" type="submit">
</div><input name="place" value="user1" type="hidden"><input name="id" value="1" type="hidden">
</td>
I use php to get this html code from my database. It's part of an message system on my site where users can send messages to other users and accept and decline the request from other users. I get the message from the db like this:
while($get = mysql_fetch_object($mysql1)){
echo $get->message;
When I try to use this information $_POST shows nothing.
I tested that with this code:
if (!empty($_POST)){
echo "test"; // nothing shows up!
}
Upvotes: 1
Views: 7537
Reputation: 382776
Make sure that:
form
tag therePOST
methodvar_dump($_POST);
Turn on error checking to see any possible errors:
ini_set('display_errors', true);
error_reporting(E_ALL);
Upvotes: 3
Reputation: 5663
You need to wrap you input fields in a FORM tag. Try:
<td colspan="3">
<div align="center">
<form method="post" action="/path/to/script.php">
<input name="Decline" id="Decline" value="Decline" type="submit">
|
<input name="Accept" value="Accept" type="submit">
</div><input name="place" value="user1" type="hidden"><input name="id" value="1" type="hidden">
</form>
</td>
Upvotes: 3