<?php
include("../../includes/connect.php");
print_r($_POST);
echo "<hr />";

     echo "Creo il nuovo set di redirect";
    $redirectSetName = $_POST['questionSetName'];

    
    $qInserimento = $connection->prepare("INSERT INTO redirect_sets (set_name) VALUES (?)");
    $qInserimento->execute(["$redirectSetName"]);
    $redirectSetId = $connection->lastInsertId();

    echo "ID: $redirectSetId";
    $urls = $_POST['redirect'];


for($d = 0; $d < count($urls); $d++)
{
    $redirectUrl = $urls[$d]['url'];
    $qDomanda = $connection->prepare("INSERT INTO redirects (url,set_in) VALUES (?,?)");
    $qDomanda->execute(["$redirectUrl","$redirectSetId"]);
    
    
}




?>