I have a page that allow user to borrow sport equipments. I have used a text field so user can put the sport equipment quantity at there. But, after the quantity's value inserted in mysql, it have a lot of commas beside the value. For example, user choose 9 quantity, so the commas appear beside the 9.
Value image
view.php
<td align='center'><input name='kuantiti[]' type='text' maxlength='2'
size='1'></td>
process.php
$kuantiti = implode(',', $_POST['kuantiti']);
if (isset($_POST['pinjam'])) {
$sql = "INSERT INTO user_request(nama, noic, jawatan, peringkat, email,
peralatansukan, kuantiti) values ('$_SESSION[nama]', '$_SESSION[noic]',
'$_SESSION[jawatan]', '$_SESSION[peringkat]', '$_SESSION[email]',
'$peralatansukan', '$kuantiti')";
This is happened because of null values in the array. use array_filter()
function to avoid this.
$kuantiti = implode(',', array_filter($_POST['kuantiti']));