我試圖將頁面中的變量值傳遞給另一頁面。使用IM進入下一個頁面,我使用會話來獲取值,如何將頁面中的值傳遞給PHP中的另一個頁面
的鏈接變量不工作,但價格變量不起作用
下面的代碼: 的index.php
<?php
require('connect.php');
if(!isset($_SESSION)){
session_start();
}
$query = mysqli_query($connection, "SELECT link, price FROM funnyture WHERE category ='Bed' or category = 'Chairs' or category = 'Tables'") or die("Couldn't find search");
$count = mysqli_num_rows($query);
if($count == 0) {
$output = "There was no row in array";
} else {
while($row = mysqli_fetch_array($query)) {
$link = $row['link'];
$price = $row['price'];
echo '
<form action="Orderform.php" method="post" class="formClass">
<input name="link" type="image" src="'.$link.'" value="'.$link.'" class="inputClass">
</form>';
}
}
?>
Orderform.php
<?php include 'navbar2.php' ;?>
<div class="left">
<?php
$_SESSION['link'] = $_POST['link'];
// $_SESSION['price'] = $_POST['price'];
echo '<img src="'.$_SESSION['link'] .'">';
echo '<p>'.$_GET['price'].'</p>';
?>
他lp me :)