Welcome Anonymous

What would you like to do?


Paste code remember you name for one cookie

Pasted by Code

Description None

On Monday 20 Mar 23:07

Language PHP

Url http://paste.ideaslabs.com/show/RQOjXcBrx5

Download Here

  1. <body>
  2.  <div class="form">
  3.  
  4.    <form method="POST">
  5.    <p>Please enter</p>
  6.         <p>Amount</p>
  7.    <input type="number" name="amount" /><br />
  8.         <p>Category</p>
  9.    <input type="text" name="category" /><br />
  10.    <p>Account</p>
  11.         <input type="text" name="account" /><br />
  12.         <p>Note</p>
  13.         <input type="text" name="note" /><br />
  14.    <input type="submit" value="Submit">
  15.  
  16.  
  17.  <?php
  18.  
  19. $dates = date('d');
  20. $month = date('m');
  21. $year = date('Y');
  22.  
  23. $amountp = $_POST['amount'];
  24. $categoryp = $_POST['category'];
  25. $accountp = $_POST['account'];
  26. $notep = $_POST['note'];
  27.  
  28. $arrayp = array($amountp,$categoryp,$accountp,$notep);
  29.  
  30.  
  31. if (isset($amountp)&&!empty($amountp)){
  32.  
  33.         $final = "\nDate:" . $dates . "\nMonth:" . $month . "\nYear:" . $year . "\nAmount:" . $amountp . "\nCategory:" . $categoryp . "\nAccount:" . $accountp . "\nNote:" . $notep . "\n";
  34.  
  35.         file_put_contents('data.txt', $final, FILE_APPEND);
  36.  
  37. }
  38.  
  39. // Retrieve data from file and process
  40.  
  41. $arraynext = file_get_contents('data.txt');
  42.  
  43. $endresult = preg_split("/Amount:/", $arraynext);
  44.  
  45.  
  46. //foreach ($endresult as $printresult) {
  47.  
  48.         $truncated = substr($printresult, 1, 2);
  49.  
  50.         print_r($truncated);
  51.  
  52. }
  53.  
  54.  ?>
  55.  
  56.  
  57.  
  58. </body>
  59.  
  60. </html>