Reputation: 1608
I have a very simple AngularJs material form. Just Name, email address and text with a very simple PHP code. Unfortunately, it's not working. I have used the same PHP code in live seerver without Angularjs Material. It worked. Now it iis not working anymore
Here are the codes
<form action="form.php" method="post">
<md-input-container class="md-icon-float md-block">
<label>Name</label>
<input type="text" rows="5" name="name">
</md-input-container>
<md-input-container class="md-block">
<input type="email" placeholder="Email (required)" ng-required="true" name="from">
</md-input-container>
<md-input-container class="md-block">
<label> message</label>
<textarea rows="2" md-select-on-focus name="message"></textarea>
</md-input-container>
<md-button class="md-button" type="submit" name="submit">
<md-icon class="material-icons">send</md-icon>
</md-button>
</form>
The PHP Code
<?php
$name = $_POST['name'];
$email = $_POST['from'];
$message = $_POST['message'];
$from = 'from the web';
$to = 'the email address';
$body = "From: $name\n E-Mail: $email\n Message:\n $message";
if ($_POST['submit']){
if (mail ($to, $from, $body)) {
echo '<p>Worked</p>';
} else {
echo '<p>Error</p>';
}
}
?>
I have also tried more straightforward way but didn't work. With this I just get a white screen
Upvotes: 0
Views: 1570
Reputation: 1608
I just found the Solution. The md-button is not submitting the information. If i replace the following part
<md-button class="md-button" type="submit" name="submit">
<md-icon class="material-icons">send</md-icon>
</md-button>
with this
<input class="md-button" type="submit" name="submit"/>
It works.
Upvotes: 2