gpt4 book ai didi

php - 如何编写返回按钮的代码?

转载 作者:IT王子 更新时间:2023-10-29 00:04:22 24 4
gpt4 key购买 nike

我这里有一个 php 代码,我想创建一个“后退”href 来让我回到之前的位置。这是我拥有的:

<input type="submit" <a href="#" onclick="history.back();">"Back"</a>

<html>
<head></head>
<body>

<?php
// get form selection
$day = $_GET['day'];
// check value and select appropriate item
if ($day == 1) {
$special = 'Chicken in oyster sauce';
}
elseif ($day == 2) {
$special = 'French onion soup';
}
elseif ($day == 3) {
$special = 'Pork chops with mashed potatoes and green salad';
}
else {
$special = 'Fish and chips';
}
?>

<h2>Today's special is:</h2>
<?php echo $special; ?>
<input type="submit" <a href="#" onclick="history.back();">"Back"</a>
</body>
</html>

最佳答案

<button onclick="history.go(-1);">Back </button>

关于php - 如何编写返回按钮的代码?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3659782/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com