SHARE
TWEET

Untitled

a guest May 22nd, 2019 77 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.     if(isset($_POST['submit'])) {
  3.         $filedate = date('Y-m-d');
  4.         $filerndm = random_int(0000, 9999);
  5.         $filename = "form-".$filedate."-".$filerndm.".json";
  6.         $json_string = json_encode($_POST, JSON_PRETTY_PRINT);
  7.         $data = file_put_contents($filename, $json_string, FILE_APPEND);
  8.        
  9.          echo json_encode($_POST['submit']);
  10.     }
  11. ?>
  12. <!DOCTYPE html>
  13. <html lang="en">
  14.     <head>
  15.         <title>FORM 2 JSON :: XAMPLE</title>
  16.         <style>*{font-family: 'Courier New',sans-serif;}</style>
  17.     </head>
  18.     <body>
  19.         <center>
  20.             <h1>FORM 2 JSON :: XAMPLE</h1>
  21.             <form name="form2json" method="post" action="http://anketa.org/json/">
  22.                 <p>
  23.                     <label for="name">Name: </label><br/>
  24.                     <input type="text" name="name" id="name" placeholder="Your full name" autofocus required>
  25.                 </p>
  26.                 <p>
  27.                     <label for="email">Email: </label><br/>
  28.                     <input type="email" name="email" id="email">
  29.                 </p>
  30.                 <p>
  31.                     <label for="phone">Phone: </label><br/>
  32.                     <input type="tel" name="phone" id="phone">
  33.                 </p>
  34.                 <p>
  35.                     <label for="dob">Date of birth: </label><br/>
  36.                     <input type="date" name="dob" id="dob">
  37.                 </p>
  38.                 <p>
  39.                     <label for="submitted">Forms submitted:</label><br/>
  40.                     0 <input type="range" name="submitted" id="submitted" min="0" max="88"> 88
  41.                 </p>
  42.                 <p style="text-align: center;">
  43.                     <input type="submit" name="submit" id="submit" value="Submit">
  44.                 </p>
  45.             </form>
  46.         </center>
  47.     </body>
  48. </html>
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