我将如何在另一个页面上回显以下结果。我需要它来回显用户选择的内容。
<strong>Return</strong>
<select id="Date" name="Date">
<option value="0">--Select date/time--</option>
<?php foreach ($return as $return) { ?>
<option value="<?php echo $return; ?>"><?php echo $return; ?></option>
<?php } ?>
谢谢
用户选择位置的完整代码。他们在此页面上选择的信息是我希望在另一个页面上得到回应的信息。
<!DOCTYPE html>
<?php
session_start();
?>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<title>
</title>
<link rel="stylesheet" href="https://ajax.aspnetcdn.com/ajax/jquery.mobile/1.2.0/jquery.mobile-1.2.0.min.css" />
<link rel="stylesheet" href="my.css" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js">
</script>
<script src="https://ajax.aspnetcdn.com/ajax/jquery.mobile/1.2.0/jquery.mobile-1.2.0.min.js">
</script>
<script src="my.js">
</script>
<!-- User-generated css -->
<style>
</style>
<!-- User-generated js -->
<script>
try {
$(function() {
});
} catch (error) {
console.error("Your javascript has an error: " + error);
}
</script>
</head>
<body>
<!-- Home -->
<div data-role="page" id="page1">
<div data-theme="a" data-role="header">
<a data-role="button" data-theme="d" href="login.html" data-icon="arrow-l" data-iconpos="left" class="ui-btn-left">
Back
</a>
<a data-role="button" href="index.html" data-icon="home" data-iconpos="right" data-theme="d"class="ui-btn-right">
Home
</a>
<h3>
Book Car
</h3>
</div>
<div data-role="content">
<h3>
Select date/time:
</h3>
<br />
<?php
{
mysql_connect("localhost" , "" , "") or die (mysql_error());
mysql_select_db("") or die(mysql_error());
$query = "SELECT `book_time`, `book_date`, `return_time`, `return_date` FROM `Rental`";
//executes query on the database
$result = mysql_query ($query) or die ("didn't query");
//this selects the results as rows
$num = mysql_num_rows ($result);
$return = array();
$rent = array();
while($row=mysql_fetch_assoc($result))
{
$rent[] = $row['book_date'].' '.$row['book_time'];
$return[] = $row['return_date'].' '.$row['return_time'];
}
}
?>
<form method="post" action="car.php">
<strong>Rent out</strong>
<select id="Date" name="Date">
<option value="0">--Select date/time--</option>
<?php foreach ($rent as $rent) { ?>
<option value="<?php echo $rent; ?>"><?php echo $rent; ?></option>
<?php } ?>
</select>
<br />
<strong>Return</strong>
<select id="Date" name="Date">
<option value="0">--Select date/time--</option>
<?php foreach ($return as $return) { ?>
<option value="<?php echo $return; ?>"><?php echo $return; ?></option>
<?php } ?>
</select>
<br />
<br />
<input type="submit" name="Submit" value="Book" />
</form>
</div>
</div>
</body>
</html>