0

Form Submission using Amp template is not working, I can't post data from amp-form by using php .Simply No action is getting performed. How to fix it? Mypage: http://samiakhalil.com/theinfotime/amp/register1.php

<?php
if (isset($_POST['register'])) {
    $name = $_POST['name'];
    $email = $_POST['email'];
    echo $name;
}
?>
<script async custom-element="amp-form" src="https://cdn.ampproject.org/v0/amp-form-0.1.js"></script> 
<form method="post"
action-xhr="https://ampbyexample.com/components/amp-form/submit-form-input-text-xhr"
target="_top">
    <input type="text" class="data-input" name="name" placeholder="Name" required>
    <input type="email" class="data-input" name="email" placeholder="Email" required>
    <input type="submit" value="Register" name="register" class="button button-primary">
</form>
yivi
  • 42,438
  • 18
  • 116
  • 138
samia
  • 19
  • 6
  • A little more detail would be helpful here. – tadman Jan 25 '17 at 05:46
  • visit my page please: http://samiakhalil.com/theinfotime/amp/register1.php – samia Jan 25 '17 at 05:54
  • Possible duplicate of [AMP form submitting with post](http://stackoverflow.com/questions/41346187/amp-form-submitting-with-post) – yivi Jan 25 '17 at 07:11
  • 2
    I can see that the request is made, but you are pointing to https://ampbyexample.com/components/amp-form/submit-form-input-text-xhr which is returning a json like {"name":"name", "email":"email@email.com"}. You should point to your own server and return a json as well. – kul3r4 Jan 25 '17 at 22:25

1 Answers1

0

add

<input type="hidden" name="register" value="a">

button name is empty, i dont know

まめたろう
  • 281
  • 1
  • 2
  • 10