我有一個模態表單。當我按下提交按鈕的PHP文件運行時出現以下錯誤: 注意:未定義的索引:phone1在C:\ xampp \ htdocs \ site \ bank.php在線2 注意:未定義的索引:charge1 in C:\ xampp在第4行將模態表單值發佈到PHP文件
這裏\ htdocs中\站點\ bank.php是在bank.php PHP代碼:
<?php
echo $_POST["phone"];
echo "</br>";
echo $_POST["charge"];
?>
這裏是模態內容:
<!-- Modal content-->
<div class="modal fade" id="register" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Modal title here</h4>
</div>
<div class="modal-body">
<form id="modal-form" class="form-horizontal" method="POST" action="bank.php">
<div class="form-group col-md-12">
<div class="form-group">
<div class="col-xs-6" style="float:right;">
<label>phone numer:</label>
<input id="phone" type="text" class="form-control" name="phone" value="pre filled value" disabled/>
<span id='display'></span>
</div>
<div class="col-xs-6" style="float:left;">
<label>charge:</label>
<input style="font-size:17px; font-weight:bold;" id="charge" type="text" class="form-control" name="charge" value="some other prefilled value" disabled/>
</div>
</div>
</div>
<div class="form-group">
<div class="col-xs-12">
<button class="btn btn-danger btn-default pull-right" data- dismiss="modal" style="margin-left:10px;">close</button>
<button type="submit" class="btn btn-success"> submit </button>
</div>
</div>
</form>
</div>
<div class="modal-footer">
modal footer
</div>
</div>
</div>
</div>
如果有一個人幫我找出我將感謝的東西;不對本
你的表單有'phone1',你的回聲是'$ _POST [「phone」]'哪一個是正確的? – teeyo
以及名稱是電話1不是電話....和charge1不收費....名稱被髮送,而不是ID .... – epascarello
您正在命名您的參數與數字(phone1,charge1),但你的php代碼回聲沒有數字('$ _POST ['change']') – gmc