0

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: enter image description here

We get every post data for the required input field except the first radio button which return empty string. Any hints?

3
  • 1
    do you put all this html code inside form or outside form?Because i am unable to see any form here? Commented Aug 30, 2018 at 10:43
  • or maybe the validation rule inside controller makes something strange, please show validation part of your controller. Commented Aug 30, 2018 at 10:44
  • what purpose this code serve. Otherwise, namely (m2): <input type="text" name="squaremeter" placeholder="m2"> missing the value parameter and may be in testing you are choosing it. Commented Aug 30, 2018 at 13:11

3 Answers 3

1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

I have already checked one radio button before sending the form.
0

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] => 
)

Comments

0

It is empty because you have a input text with the same name as radibuttons: squaremeter

Rename the input text to squaremeter-other.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.