php - Inserting POST data in to a sorted array -
i trying insert post info multiple inputs in array.
screenshot of view
here code view
{{ form::open(array('url'=>'roster/sequence'))}} <h3>generate roster sequence</h3> <desc>please come in sequence below.</desc> <table> <tr> <th>day</th> <th>morning</th> <th>evening</th> <th>night</th> <th>off</th> </tr> @for ($d = 1; $d < 8; $d++) <tr class="tbrow"> <td>{{ "day ".$d}}</td> @for ($s = 1; $s < 5 ; $s++) <td> <div class="textbo"> @for ($n = 0; $n < 5 ; $n++) {{-- */ $name = "".$d.":".$s.":".$n; /* --}} {{ form::text($name)}} @endfor </div> </td> @endfor </tr> @endfor </table> <p> {{ form::submit('create sequence', array('class'=>'button medium')) }} <input type="hidden" name="_token" value="<?php echo csrf_token(); ?>"> </p> {{ form::close() }}
controller fetches info post below
public function storesequence(){ $input = input::except('_token');; foreach ($input $key => $value) { //echo "".$value."::::".$key; list($day, $shift, $slot) = explode(":", $key); echo "day : ".$day."shift is: ".$shift." slot : ".$slot." value is::::".$value."</br>"; } }
end goal is accomplish array represents info below:
day : shift1: shift2: shift3: off 1 : 1,2,3 4,5,6 7,8,9 10,11
i not quite sure how can that, , here asking guys. in advance :)
php arrays laravel
No comments:
Post a Comment