SHARE
TWEET

Untitled

a guest Jan 20th, 2017 80 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <span id="price">900</span>
  2. <form id="contruct-from">
  3.    <input name="namecontr">
  4.    <input name="telcontr">
  5.    <input name="emailcontr">
  6.    <button form="contruct-from" type="submit">ОТПРАВИТЬ</button>
  7. </form>
  8.    
  9. $('.btn-contruct').click(function(){
  10.     if($("#contruct-from")[0].checkValidity()) {
  11.         $.post('Post_Constructor.php', '&item_price=' + $('#price').text() + $('#contruct-from').serializeArray(), function(data) {
  12.  
  13.         });
  14.             console.log('ok');
  15.             return false;
  16.  
  17.         }
  18.     });
  19.    
  20. <?php
  21. session_start();
  22.  
  23. new post_contact($_POST);
  24.  
  25. class post_contact
  26. {
  27.  
  28. public function __construct($post_data)
  29. {
  30.     $this->send_contact_form($post_data);
  31. }
  32.  
  33. function send_contact_form($post_data)
  34. {
  35. $headers = "MIME-Version: 1.0" . PHP_EOL .
  36. "Content-Type: text/html; charset=utf-8" . PHP_EOL .
  37. 'From: test@email.com <test@email.com>' . PHP_EOL;
  38.  
  39. $message = '<p>'.$_POST['namecontr'].'</p>';
  40. $message .= '<p>'.$_POST['telcontr'].'</p>';
  41. $message .= '<p>'.$_POST['emailcontr'].'</p>';
  42. $message .= '<p>'.$_POST['item_price'].'</p>';
  43.  
  44. mail('test@email.com', 'Помогите пожалуйста', $message, $headers );
  45. }
  46. }
  47.    
  48. $('#contruct-from').serialize()
  49.    
  50. $('#contruct-from').serializeArray();
  51.    
  52. $.post('Post_Constructor.php',  'item_price=' + $('#price').text() +'&'+ $('#contruct-from').serialize(), function(data) {});
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top