我正在用PHP开发一个项目,但我的java并不好。我试图链接两页。第一页有一个包含“其他”的按钮,用于捐赠,其应该以用户应该单击按钮的方式工作,重定向到下一页,其中不应禁用该金额的输入文本字段。
我希望你能够帮助我,因为我几乎在这里阅读了关于onclick事件和其他选项的所有帖子并尝试了它们但没有运气。
//Code for the other button
<td style="padding: 6px;">
<span>
<form action="getcreditcard.php" method="POST">
<input type="hidden" value="<?php echo base64_encode(6); ?>" name="id">
<button type="submit" id="donate" value="Other" class="btn btn-warning" style="width: 100%;">Other</button>
</form>
</span>
</td>
//Code for the receiveing page getcreditcard.php
<
} else if (base64_decode($_POST['id']) == 6) {
$p_price ='Add Amount Here.';
$p_currency = 'USD';
$p_name = 'Donation Option 5';
}
>
and
<div class="form-row">
<label>
<span>Amount (USD)</span>
<input type="text" name="amount"placeholder="enter amount " value="$ <?php echo $p_price; ?>" disabled="true" required="true">
</label>
</div>
像这样使用javascript jquery prop():
<!-- simple example: -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<form>
Input:
<input type="text" name="amount" id="amount" placeholder="enter amount " value="$ <?php echo $p_price; ?>" required>
</form>
<script type="text/javascript">
$(document).ready(function(){
$("#amount").prop("disabled", true);
});
</script>
你可以使用readonly我希望这能帮到你。
<input type="text" readonly value="<?php echo base64_encode(6); ?>" name="id">