Reputation: 157
I have a simple form which was working and now im finding the post data isnt being sent and i can't see the problem
<form role="form" name="challengeform" action="scripts/arena_setup.php" method="POST" onsubmit="return confirm('Are you sure you want to attack this player?');">
<input type="hidden" name="member_id" value="<? echo $member_id;?>">
<input type="image" src="img/map/attack.png" alt="Attack" />
</form>
which is being handled by
if(isset($_POST['challengeform'])){
...
}else{ echo 'error'; }
it always shows the error due to the post data being missing but i just cant see what i've done. Any ideas?
Upvotes: 2
Views: 1210
Reputation: 344
You shouldn't write the name of the form. Just write input's name to get the data. Ex:
$var = $_POST['member_id'];
Upvotes: 0
Reputation: 31654
if(isset($_POST['challengeform']))
Form names are not part of the POST data. Only fields within the form.
Try testing for the field itself
if(isset($_POST['member_id']))
Upvotes: 4