2
리디렉션에 대한 질문이 있습니다. $ _GET을 사용하여 변수를 가져올 수 있도록 일부 매개 변수를 URL에 넣었습니다. 이제 폼을 잘못 채울 때 리디렉션되지만 모든 매개 변수가 누락되어 더 이상 변수에 없습니다. 동일한 매개 변수를 사용하여 동일한 페이지로 리디렉션 할 수있는 방법이 있습니까? 매개 변수
URL : http://localhost:8888/WD2/Week6/Project/flight_bestel.php
감사 는 enter image description here enter image description here
<?php
session_start();
include_once ("scripts/config.php");
include_once ("scripts/api.php");
$stoelNr = $_GET['stoelnr'];
$prijs = $_GET['prijs'];
$bestemming = $_GET['bestemming'];
$aankomst = $_GET['aankomst'];
if($_SERVER['REQUEST_METHOD'] === 'POST') {
}else{};
?>
<?php require_once('views/shared/_header.inc'); ?>
<body>
<header>
<?php include('views/shared/_nav.inc'); ?>
</header>
<main>
<div id="contents" class="container">
<section id="summary">
<form action= "<?php echo $_SERVER['PHP_SELF']; ?>" method="post" class="form-horizontal">
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-info" name="bestel">Bestel nu!</button>
</div>
</div>
</form>
</section>
</div>
</main>
<?php require_once('views/shared/_footer.inc'); ?>
php 7에서 사용할 수있는 null 병합 사용 http://php.net/manual/en/migration70.new-features.php#migration70.new-features.null-coalesce-op – Krish
필드의 초기 값을 '$ _get (field name)' –
'header()'가 필요하다고 생각합니다. http://php.net/manual/en/function.header.php – akrys