<?php

$sql = 'SELECT * FROM `transports`';
$sth = $dbh->prepare($sql, [PDO::ATTR_CURSOR => PDO::CURSOR_FWDONLY]);
$sth->execute([]);
$transportsArr = $sth->fetchAll();


if(!empty($_POST['newOrder'])){
    $sql = 'INSERT INTO `orders`(`transport_id`, `start_date`,
    `payment_id`)
    VALUES (:transport_id, :start_date, :payment_id)';
    $sth = $dbh->prepare($sql, [PDO::ATTR_CURSOR => PDO::CURSOR_FWDONLY]);
    $sth->execute([
        "transport_id" => $_POST['transport_id'],
        "start_date" => $_POST['start_date'],
        "payment_id" => $_POST['payment_id']
    ]);
}
?>