B
B
byshyi462016-02-25 17:03:55
PHP
byshyi46, 2016-02-25 17:03:55

Why doesn't it switch to robokassa on the second form?

Guys. Why in the first form transfers to the robokassa, but not in the second form?

<form id="form-buy">
        <input type="hidden" name="tariff" value="200 зрителей за 600 рублей"/>
        <input type="hidden" name="name" value="@<?php echo $_GET["user"]; ?>" autocomplete="off"/>
        <button type="submit" value="Оплатить">Купить за 600 рублей</button>
      </form>
      <form id="form-buy">
        <input type="hidden" name="tariff" value="400 зрителей за 800 рублей"/>
        <input type="hidden" name="name" value="@<?php echo $_GET["user"]; ?>" autocomplete="off"/>
        <button type="submit" value="Оплатить">Купить за 800 рублей</button>
      </form>

$(document).ready(function() {

  $("#form-buy").submit(function() {
    $.ajax({
      type: "POST",
      url: "mail/buy.php",
      data: $(this).serialize()
    }).done(function() {
      $(this).find("input").val("");
      $("#form-buy").trigger("reset");
      location.href = 'https://partner.robokassa.ru/OfflineInvoice/Invoice/e773e29d-875b-4da9-9b47-ad3d9db459e1'
    });
    return false;
  });
  
});

<?php

$recepient = "[email protected]";
$sitename = "upperiscope.ru";

$name = trim($_POST["name"]);
$tariff = trim($_POST["tariff"]);
$message = "Логин: $name \nТариф: $tariff";

$pagetitle = "Новое сообщение \"$sitename\"";
mail($recepient, $pagetitle, $message, "Content-type: text/plain; charset=\"utf-8\"\n From: $recepient");
?>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey, 2016-02-25
@byshyi46

And who will learn the basics of html?
You can't use id twice. id - unique element on the page

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question