CODE (htmlphp):
скопировать код в буфер обмена
скопировать код в буфер обмена
- <body>
- <form method='POST' accept-charset="UTF-8" action="send.php" id='card' style="float:left; background: #fff; box-shadow: -4px -3px 3px 6px #a5a5a5; border-radius:5px; margin: 0 auto; position: absolute; left: 580px; top: 230px;">
- <div style="margin-left: 13px;">
- <p style="line-height:10px;">Номер CAS</p>
- <input name="numcas" type="text" style="border:1px solid #a5a5a5; border-radius: 5px; width: 380px; height: 30px; margin-bottom:10px;">
- <input name="sendcard" onClick="saveform (this.form);return false;" type="submit" value="Отправить запрос"></input>
- </div>
- </form>
- <?
- if(isset($_POST['sendcard'])){
- $numcas = $_POST['numcas'];
- $message = "Номер CAS: $numcas";
- $pagetitle = "Новая заявка с сайта \"$from\"";
- $to = "....ru";
- $from = "admin@center.org";
- $headers = "Content-type: text/plain; charset=utf-8 \r\n";
- $headers .= "From: $from \r\n";
- mail($to, $pagetitle, $message, $headers);
- }?>
- <script>
- $('#card').submit(function(e){
- e.preventDefault();
- $.ajax({
- url: "send.php",
- type: "POST",
- data: $('#card').serialize(),
- success: function(response) {
- //обработка успешной отправки
- },
- error: function(response) {
- //обработка ошибок при отправке
- }
- });
- });
- </script>
- </body>