mercredi 14 octobre 2015

How to insert multiple skills at once?

I have following table

skills

id|skill_name|category

user table

id | username

add_skill

id|userid|skill_id|rating

i want to insert all skills of ther user into add_skill table

<table class="table table-bordered table-design">
<form class="form-signin" method="POST" action="{{url('admin/my-skills')}}">
            {!! Form::token() !!}


            <tr class="table-header" >

                <th rowspan="2">ID</th>

                <th rowspan="2"> Skills</th>

                <th colspan="5"  >Rate Your Skills Out of 5</th>



            </tr>
<tr class="radio-content table-header">
      <th  class="radio-content">1 star</th>
      <th class="radio-content">2 star</th>
      <th class="radio-content">3 star</th>
         <th class="radio-content">4 star</th>
            <th class="radio-content">5 star


            </th>
    </tr>

<?php $i=1; ?>

@foreach($data as $val)
            <tr>

                <td>{{$i}}</td>

                <td>{{$val->skill_name}}</td>

                <td class="radio-content"><input type="radio" name="q{{$i}}" value="1" /></td>
                <td class="radio-content"><input type="radio" name="q{{$i}}" value="2"/></td>
                <td class="radio-content"><input type="radio" name="q{{$i}}" value="3"/></td>
                <td class="radio-content"><input type="radio" name="q{{$i}}" value="4" /></td>
                <td class="radio-content"><input type="radio" name="q{{$i}}" value="5"/></td>


            </tr>
            {{$i++}}
@endforeach

            <tr>
            <td colspan="2"><p class="submit-label">Submit</p></td>
                <td colspan="5"><button type="submit" class="btn-new btn-submit">Submit Your Skills</button></td>
            </tr>



</form>
    </table>

enter image description here when i submit the form i need to insert all skill in add_skill table.But my problem is i cant set same name for all input radio.if i set name same then i can choose only one item.can any one tell how i can achieve this ? if am wrong in my table structure please guide me. Thank you



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire