I understand how to send this form normally with a regular submit. I however am confused as to how to send my multidimensional form array via .ajax.
My form:
<form action="week_update.php" id="theform" method="post">
<input type="text" name="data[][wednesday_crew]" value=""/>
<input type="text" name="data[][thursday_crew]" value=""/>
<input type="text" name="data[][friday_crew]" value=""/>
<input type="text" name="data[][saturday_crew]" value=""/>
<input type="text" name="data[][sunday_crew]" value=""/>
My PHP:
$stmt = $connection->stmt_init();
if($stmt->prepare("UPDATE tableName SET ... = ?, ... = ?,)) {
// Bind your variables
$stmt->bind_param('ss', $.., $..,);
// get the multi array from form
$returnedData = $_POST['data'];
//let's loop through it.
for($i=0;$i<count($returnedData);$i+=2){
$log_dates_ID = $returnedData[$i]['...'];
$crew_chief = $returnedData[$i+1]['...'];
$stmt->execute();
}