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

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -