I am trying to insert an array into a database via a dynamic form. The form will insert the first values from the form but not any more. tried a couple of methods and have hit a wall.
Here is the PHP file:
<?php
$con = new MySQLi(CONNECTION INFORMATION);
if (!$con)
{
die('Could not connect: ' . mysqli_error());
}
foreach($_POST['room_types'] as $cnt => $room_types);
$room_type = implode(",", $room_types);
foreach($_POST['rooms'] as $cnt => $rooms);
$room = implode(",", $rooms);
foreach($_POST['users'] as $cnt => $users);
$user = implode(",", $users);
foreach($_POST['qty'] as $cnt => $qty);
$sql="INSERT INTO ConfigForm (HotelName,ADD1,ADD2, town, county, postcode, phone, fax, hotel_email, website_url, hotel_contact_name, accounts_contact_name, accounts_email, web_dev_company, web_dev_contact, web_dev_email, tarrif_selection, website_link, payment_select_box, barclays, barclays_store_id, barclays_username, barclays_password, worldpay, worldpay_username, worldpay_password, secpay_username, secpay_password, secpay_template, securetrading, securetrading_site_ref, securetrading_username, securetrading_password, sagepay, sagepay_account, sagepay_password, welcome_secure, welcome_secure_account, no_payment, paypal, paypal_account,roomnum,roomtype)
VALUES
('$_POST[hotel_name]','$_POST[address_line1]','$_POST[address_line2]','$_POST[town]','$_POST[county]','$_POST[postcode]','$_POST[phone]','$_POST[fax]','$_POST[hotel_email]','$_POST[website_url]','$_POST[hotel_contact_name]','$_POST[accounts_contact_name]','$_POST[accounts_email]','$_POST[web_dev_company]','$_POST[web_dev_contact]','$_POST[web_dev_email]','$_POST[tarru]','$_POST[website_link]','$_POST[payment_select_box]','$_POST[barclays]','$_POST[barclays_store_id]','$_POST[barclays_username]','$_POST[barclays_password]','$_POST[worldpay]','$_POST[worldpay_username]','$_POST[worldpay_password]','$_POST[secpay_username]','$_POST[secpay_password]','$_POST[secpay_template]','$_POST[securetrading]','$_POST[securetrading_site_ref]','$_POST[securetrading_username]','$_POST[securetrading_password]','$_POST[sagepay]','$_POST[sagepay_account]','$_POST[sagepay_password]','$_POST[welcome_secure]','$_POST[welcome_secure_account]','$_POST[no_payment]','$_POST[paypal]','$_POST[paypal_account]','$qty','".$_POST['name'][$cnt]."')";
if (!mysqli_query($con,$sql))
{
die('Error: ' . mysqli_error($con));
}
echo "<h1>Form Submitted!<h1>";
mysqli_close($con);
?>
Here is a link to the form: http://apollowebtools.com/WAForm/config_form.html
Any help much appreciated, Thanks