【发布时间】:2019-08-28 15:08:22
【问题描述】:
我有这个用表单生成行的 javascript 代码。但我需要在值中添加一个关联的 php 变量(代码中的 var uno),但它不起作用。非常感谢您的帮助。
function formHtml() {
var uno ='<input type="text" <?php echo" value='$pe';?> data-type="address" name="address[]" id="address_'+rowcount+'" class="form-control autocomplete_txt" autocomplete="off">';
html = '<tr id="row_'+rowcount+'">';
html += '<th id="delete_'+rowcount+'" scope="row" class="delete_row"><img src="./src/images/minus.svg" alt=""></th>';
html += '<td>';
html += '<input type="text" data-type="countryname" name="countryname[]" id="countryname_'+rowcount+'" class="form-control autocomplete_txt" autocomplete="off">';
html += '</td>';
html += '<td>';
html += '<input type="text" data-type="countryno" name="countryno[]" id="countryno_'+rowcount+'" class="form-control autocomplete_txt" autocomplete="off">';
html += '</td>';
html += '<td>';
html += '<input type="text" data-type="phone_code" name="phone_code[]" id="phone_code_'+rowcount+'" class="form-control autocomplete_txt" autocomplete="off">';
html += '</td>';
html += '<td>';
html += '<input type="text" data-type="country_code" name="country_code[]" id="country_code_'+rowcount+'" class="form-control autocomplete_txt" autocomplete="off">';
html += '</td>';
html += '<td>';
html += uno;
html += '</td>';
html += '</tr>';
rowcount++;
return html;
}
【问题讨论】:
-
rowcount 是 PHP 变量吗?
-
@Emiel 看起来像 $pe
-
@aequalsb 谢谢!
标签: javascript php html forms