javascript - PHP checkboxes in sequentially ordered -


<form method="post" action="">      <input type="checkbox" name="boxes[]" value="alpha">alpha</input>      <input type="checkbox" name="boxes[]" value="beta">beta</input>      <input type="checkbox" name="boxes[]" value="omega">omega</input>      <input type="submit" name ="submit" value="submit"> </form> 

in form, how can array values order picks?

for example if went pick beta>omega>alpha array ['beta', 'omega', 'alpha']

instead of ['alpha', 'beta', 'omega']

then after calling in php

if(isset($_get['submit'])){     $boxes = $_get['boxes'];     //here 2nd problem } 

what i'm trying @ //here 2nd problem echoing each name order array, example

the ['beta', 'omega', 'alpha'] like

echo 'b'; echo 'o'; echo 'a'; 

as ordered in array.

so how can that?

because of form information sent @ once @ submission, there's no way order selected without using javascript.

if wanted, record checkbox selections js, store keys separate array or list, , pass array hidden field.

 <form method="post" action="">       <input type="checkbox" name="boxes[]" value="alpha">alpha</input>       <input type="checkbox" name="boxes[]" value="beta">beta</input>       <input type="checkbox" name="boxes[]" value="omega">omega</input>        <!-- update field dynamically javascript. -->       <input type="hidden" name="checkboxorder" value="" />        <input type="submit" name ="submit" value="submit">  </form> 

it might sticky if users uncheck boxes after checking, regardless, that's way i'd approach problem.


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -