PHP: Post 70 Variables --> Array --> MySQL -
i have php page around 70 fields gets posted.
31 have following patern: hours_1, hours_2, hours_3 etc..
31 have following patern: description_1, description_2, description_3 etc..
there few other variables/fields clientid, month, year
can see, yes looks timesheet. gets posted , therefore hours in 1 array , descriptions in , after insert in table.
how these hour , description fields neatly array (or 2 arrays) can, after validation, use them insert them mysql table?
in php or html, can use [] convention name or receive variables arrays on server side i.e.
instead of generating variables _number seem doing, can:
<?php foreach(range(0, 30) $i): ?> <input name="hours[]"> <?php endforeach; ?>
this allow neatly receive array on server side can
$_post['hours'];//will give array of hour inputs if submit post
Comments
Post a Comment