I have created a contact form in which fields are generated via an ACF repeater field in my custom post type.
I can get the rest of the form to send however im not sure how to go about the PHP side of things to submit the repeater fields?
here's what I have so far:
HTML:
<label for="<?php the_sub_field('product_name'); ?>"><?php the_sub_field('product_name'); ?> ($<?php the_sub_field('product_price'); ?>)</label>
<input id="<?php the_sub_field('product_name'); ?>" type="number" name="" value="0" />
PHP:
<?php
// Get data
$orderbusin = $_POST[“orderbusin”];
$ordercontac = $_POST[“ordercontac”];
$orderemail = $_POST[“orderemail”];
$ordernumber = $_POST[“ordernumber”];// Database connection
$conn = mysqli_connect(“Database Host”,”Database Username”,”Database Password”,”Database Name”);
if(!$conn) {
die(‘Problem in database connection: ‘ . mysql_error());
}// Data insertion into database
$query = “INSERT INTO ‘Database Name’.’Table Name’ ( ‘orderbusin’, ‘ordercontac’, ‘orderemail’, ‘ordernumber’ ) VALUES ( $orderbusin, $ordercontac, $orderemail, $ordernumber )”;
mysqli_query($conn, $query);// Redirection to the success page
header(“Location: http://example.com/thank-you-for-your-order/“);
?>