Javascript 无法在POST表单中发送特定值
我有一个必须通过表单发送的值问题,看起来页面没有收到$sender值Javascript 无法在POST表单中发送特定值,javascript,php,jquery,html,Javascript,Php,Jquery,Html,我有一个必须通过表单发送的值问题,看起来页面没有收到$sender值 <script type="text/javascript"> $("button[name='Security']").click(function(){ $("#placeholder").html(<?php $sender=basename($_SERVER[PHP_SELF]); ?>
<script type="text/javascript"> $("button[name='Security']").click(function(){
$("#placeholder").html(<?php $sender=basename($_SERVER[PHP_SELF]); ?>
"
<form class='form-horizontal' method='post' action='changePassword.php'>
<div class='form-group'>
<label for='username' class='col-sm-9 text-center' control-label><span class='label label-danger'><i class='fa fa-eye'></i> Change Password </span> </label>
</div> <!-- col-sm-9 --> <!-- form-group -->
<div class='form-group'>
<label style='margin:5px' for='currentpassword' class='col-sm-4 text-center' control-label><span class='label label-info'><i class='fa fa-eye'></i> Current Password </span></label>
<input style='margin:5px' class='col-sm-5' name='currentpassword' class='form-control' type='password' >
</div>
<div class='form-group'>
<label style='margin:5px' for='password' class='col-sm-4 text-center' control-label><span class='label label-success'><i class='fa fa-eye'></i> New Password </span></label>
<input style='margin:5px' class='col-sm-5' name='password' class='form-control' type='password' >
</div>
<div class='form-group'>
<label style='margin:5px' for='confirmpassword' class='col-sm-4 text-center' control-label><span class='label label-success'><i class='fa fa-eye'></i> Confirm Password </span></label>
<input style='margin:5px' class='col-sm-5' name='confirmpassword' class='form-control' type='password' >
</div>
<div class='form-group>
<input type='hidden' name='sender' value=' <?php echo $sender; ?>' class='form-control' id='sender' >
<button type='submit' class='btn btn-success btn-block'><span class='fa fa-check'></span> Change Password!</button> </div> </form>");
});
</script>
$(“按钮[name='Security'])。单击(函数(){
$(“#占位符”).html(
"
修改密码
当前密码
新密码
确认密码
请像这样更改代码
<?php
$sender = isset($_SERVER["PHP_SELF"])? "":basename($_SERVER["PHP_SELF"]);
?>
<script type="text/javascript">
$("document").ready(function(){
$("button[name=Security]").click(function(){
$("#placeholder").html("<form class='form-horizontal' method='post' action='changePassword.php'><div class='form-group'><label for='username' class='col-sm-9 text-center' control-label><span class='label label-danger'><i class='fa fa-eye'></i> Change Password </span> </label></div> <!-- col-sm-9 --> <!-- form-group --> <div class='form-group'><label style='margin:5px' for='currentpassword' class='col-sm-4 text-center' control-label><span class='label label-info'><i class='fa fa-eye'></i> Current Password </span></label> <input style='margin:5px' class='col-sm-5' name='currentpassword' class='form-control' type='password' ></div><div class='form-group'><label style='margin:5px' for='password' class='col-sm-4 text-center' control-label><span class='label label-success'><i class='fa fa-eye'></i> New Password </span></label><input style='margin:5px' class='col-sm-5' name='password' class='form-control' type='password' ></div><div class='form-group'><label style='margin:5px' for='confirmpassword' class='col-sm-4 text-center' control-label><span class='label label-success'><i class='fa fa-eye'></i> Confirm Password </span></label><input style='margin:5px' class='col-sm-5' name='confirmpassword' class='form-control' type='password' ></div><div class='form-group><input type='hidden' name='sender' value=' <?php echo $sender; ?>' class='form-control' id='sender' ><button type='submit' class='btn btn-success btn-block'><span class='fa fa-check'></span> Change Password!</button> </div> </form>");
});
});
</script>
$(“文档”).ready(函数(){
$(“按钮[name=Security]”。单击(函数(){
$(“#占位符”).html(“更改密码当前密码新密码确认密码实际上我看到我忘记了一个”
我已经像那样将代码写入了js,我只是以一种你可以阅读的方式在这里扩展代码。我将尝试这一个。干杯