<?php
$paseoLocationTo=$_POST['locationTo'];
$paseoLocationFrom=$_POST['locationFrom'];
$PTime=$_POST['time'];
echo"The value of Location to is $paseoLocationTo </br>";
echo"The value of Location from is $paseoLocationFrom </br>";
echo"The value of time is $PTime </br>";
mysql_connect('localhost', 'root', '')
or die(mysql_error());
mysql_select_db('shuttle_service_system')
or die(mysql_error());
$TripID =mysql_query("
SELECT DISTINCT Trip_ID as 'TripID'
FROM trip
WHERE Timeslot LIKE '$PTime' AND Location_From Like '$paseoLocationFrom' AND Location_To LIKE '$paseoLocationTo'
");
echo "<form action='LastPage.php' method='post'>";
while($check = mysql_fetch_array($TripID))
**echo "<name='TripID' id='TripID'>" . $check['TripID'] . " ";**
echo "<p class='sure'> Are you sure with your reservation? </p>";
echo"<input type='submit' value='Submit' class='Log'>";
echo"</form";
?>
从另一个 php 文件,这是 LastPage.php
<?php
**$TripID=$_POST['TripID'];
echo"The value of trip ID is $TripID </br>";**
?>
大家好,我想知道为什么我不能访问其他 php 文件中的“TripID”变量?我以前访问过它,但现在似乎有问题,我这样做对吗?我很抱歉一个 php 和 SQL 新手。