Reputation: 613
Here is the form for user to fill in:
<form action="/process" method="post>
<div class="donationarea">
<strong>I would like to adopt:*</strong>
<fieldset class="form-group">
<div class="form-check">
<input class="form-check-input" type="radio" name="squaremeter" value="1">
<label class="form-check-label">
1 m2 (€ 2,50)
</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="squaremeter" value="4">
<label class="form-check-label">
4 m2 (€ 10,-)
</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="squaremeter" value="10">
<label class="form-check-label">
10 m2 (€ 25,-)
</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="squaremeter" value="20">
<label class="form-check-label">
20 m2 (€ 50,-)
</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="squaremeter" value="other">
<label class="form-check-label">
Otherwise, namely (m2): <input type="text" name="squaremeter" placeholder="m2">
</label>
</div>
</fieldset>
</div>
</form>
After click submit button, here are the data returned from the form:
We get every post data for the required input field except the first radio button which return empty string. Any hints?
Upvotes: 0
Views: 633
Reputation: 1014
It is empty because you have a input text with the same name as radibuttons: squaremeter
Rename the input text to squaremeter-other
.
Upvotes: 0
Reputation: 163
In Simple think you need to changes you Otherwise, namely (m2) input text name to name="squaremeter-1" then you will be get value
Array
(
[squaremeter] => other
[squaremeter-1] =>
)
Upvotes: 0
Reputation: 1270
Please check one radio button. If you are not check any radio button then it comes blank in post.
may be it will help you.
Upvotes: 1