以下是我通过按钮调用php函数的代码。但是我点击的按钮没有触发该功能。
<form method="POST" action="">
<div class="navbar-collapse collapse" id="navbar-main">
<ul class="nav navbar-nav navbar-right">
<li style="padding:10px;">
<button type="submit" name="imp" id="subDownload" class="btn btn-success subDownload" value="download"> <span class="glyphicon glyphicon-envelope"></span> Send Email</button>
</li>
</ul>
</div>
<div id="address" >
<h4>To:</h4>
<textarea id="address" name="invoice_address_to" class="form-control input-noshow" rows="6" cols="35">
Some Company
Address 1
Address 2
Zipcode
State
Country
</textarea>
</div>
</div>
</form>
<?php
function test()
{
print_r (explode('/n',invoice_address_to));
}
if (isset($_POST['imp'])) {
test();
}
?>
任何人都可以帮助我。
答案 0 :(得分:0)
您发布的文字未提交至功能测试。你可以通过以下代码更新你的PHP代码来实现它
<?php
function test($string)
{
#print_r(explode('/n',$string));
var_dump($string);
}
if (isset($_POST['imp']))
{
test($_POST['invoice_address_to']);
}
?>