My radio input is repeating

Asked

Viewed 75 times

0

My radio input only on this line 3 is repeating the others not. Follows picture for better understanding:

inserir a descrição da imagem aqui

Excerpt from the code where it is repeated...

<div class="section4">
        <td>Cumprimento de Horário (pontualidade dos horários de viagens).</td>
        <td WIDTH=9 align="center"> <input type="radio" name=" horario" value="A"/> </td>
        <td WIDTH=9 align="center"> <input type="radio" name=" horario" value="B"> </td>
        <td WIDTH=9 align="center"> <input type="radio" name=" horario" value="C"/> </td>
        <td WIDTH=9 align="center"> <input type="radio" name=" horario" value="D"/> </td>
        <td WIDTH=9 align="center"> <input type="radio" name=" horario" value="E"/> </td>
        <td WIDTH=9 align="center"> <input type="radio" name="horario" value="F"/> </td>
        <td WIDTH=9 align="center"> <input type="radio" name="horario" value="G"/> </td>
        </div>

Excerpt from the PHP code:

 $section4 =isset($_POST["horario"])?$_POST["horario"]:"[nao informado]";
  • Maybe take this space from the beginning of the name solves?

2 answers

1

The name your radios are different. Either remove the space of everyone or put space in all.

How are you:

<div class="section4">
        <td>Cumprimento de Horário (pontualidade dos horários de viagens).</td>
        <td WIDTH=9 align="center"> <input type="radio" name=" horario" value="A"/> </td>
        <td WIDTH=9 align="center"> <input type="radio" name=" horario" value="B"> </td>
        <td WIDTH=9 align="center"> <input type="radio" name=" horario" value="C"/> </td>
        <td WIDTH=9 align="center"> <input type="radio" name=" horario" value="D"/> </td>
        <td WIDTH=9 align="center"> <input type="radio" name=" horario" value="E"/> </td>
        <td WIDTH=9 align="center"> <input type="radio" name="horario" value="F"/> </td>
        <td WIDTH=9 align="center"> <input type="radio" name="horario" value="G"/> </td>
        </div>

How it should look:

<div class="section4">
        <td>Cumprimento de Horário (pontualidade dos horários de viagens).</td>
        <td WIDTH=9 align="center"> <input type="radio" name="horario" value="A"/> </td>
        <td WIDTH=9 align="center"> <input type="radio" name="horario" value="B"> </td>
        <td WIDTH=9 align="center"> <input type="radio" name="horario" value="C"/> </td>
        <td WIDTH=9 align="center"> <input type="radio" name="horario" value="D"/> </td>
        <td WIDTH=9 align="center"> <input type="radio" name="horario" value="E"/> </td>
        <td WIDTH=9 align="center"> <input type="radio" name="horario" value="F"/> </td>
        <td WIDTH=9 align="center"> <input type="radio" name="horario" value="G"/> </td>
        </div>

Note that I removed the spaces, and everything was left name="horario".

Just a reminder, if you are using table, there is no need for this div, it’s not even normal to do that.

0

It is the name that some have a space and others do not. Change to.:

<tr class="section4">
    <td>Cumprimento de Horário (pontualidade dos horários de viagens).</td>
    <td WIDTH=9 align="center"> <input type="radio" name="horario" value="A"/> </td>
    <td WIDTH=9 align="center"> <input type="radio" name="horario" value="B"> </td>
    <td WIDTH=9 align="center"> <input type="radio" name="horario" value="C"/> </td>
    <td WIDTH=9 align="center"> <input type="radio" name="horario" value="D"/> </td>
    <td WIDTH=9 align="center"> <input type="radio" name="horario" value="E"/> </td>
    <td WIDTH=9 align="center"> <input type="radio" name="horario" value="F"/> </td>
    <td WIDTH=9 align="center"> <input type="radio" name="horario" value="G"/> </td>
 </tr>
  • blz Tiago, I’m going to test.. and div.. is why I call it in php .. as variable Section.. I don’t know if it’s right..

  • As @Randrade said and very well being the div is strange. Wouldn’t you like to have tr? edited the answer. In your question put php so we can help.

  • I changed.. and put the tr’s looked great !! thanks. I’m looking now and searching how I can generate an xml after entering this information...

Browser other questions tagged

You are not signed in. Login or sign up in order to post.