HTML code
<form>
<div class="list">
<div class="list list-inset" >
<label class="item item-input" id="descriptions">
<input type="text" height:"90" class="description" placeholder="Description ..." ng-model="data.describe" required>
</label>
<label input="email" class="item item-input" id="email" ng-model="data.email" required >
<span class="input-label">Email</span>
<input type="email">
</label>
<label class="item item-input" id="date">
<span class="input-label">Date</span>
<input type="date">
</label>
</div>
<button class="button button-block button-balanced" type="submit" ng-click="AddItem(); submitForm()">
Add Item
</button>
<button class="button button-block button-assertive" ng-click="closeModal()"> cancel</button>
</div>
</form>
app.js
$scope.submitForm = function() {
console.log("posting data....");
$http.post('localhost:80/api.php', JSON.stringify($scope.data)).success(function () {/*success callback*/ });
};
PHP COde
<?php
$name=$_POST['descriptions'];
$email=$_POST['email'];
$message=$_POST['date'];
var_dump($name);
if (($descriptions =="")||($email=="")||($date==""))
{
echo "All fields are required, please fill <a href=\"\">the form</a> again.";
}
else{
$from="From: $descriptions<$email>\r\nReturn-path: $email";
$subject="Message sent using your contact form" + $date;
mail("testing@gmail.com", $subject, $message, $from);
echo "Email sent!";
}
?>
我正在尝试通过电子邮件将表单结果发送到输入字段但收到错误:500(内部服务器错误)。我确信我正在给出正确的端口号,我的wamp正在运行。我在Google Chrome上运行我的应用程序。