【发布时间】:2013-09-13 18:13:26
【问题描述】:
我正在尝试在单击按钮时将文本框值用作会话变量,到目前为止我可以使用它但它是硬编码的,我如何让它使用文本框值来代替?
这是会话代码:
<?php
session_start();
$_SESSION['url'] = "url";
?>
这是文本框:
echo "<input type='text' id='starurl' value=''/>";
echo "<br><button onclick='save_a9({$row99['starID']})'>Approve</button><button onclick='save_d9({$row99['starID']})'>Disapprove</button><br>";
这是 save_a9:
function save_a9(id) {
$.post('response6.php', {starID:id},
function(result) {
alert(result);
window.location.reload();
});
}
你是这个意思吗?该值不需要表单,只需转到另一个页面即可使用
<?php
session_start();
if (isset($_POST['url']) {
$_SESSION['url'] = $_GET['url'];
}
?>
echo "<input type='text' id='starurl' value='" . htmlspecialchars($_SESSION['url'])"
【问题讨论】: