Advertisement
Guest User

Untitled

a guest
Jun 27th, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. [wholesalePrices] => Array
  2. (
  3. [0] => Array
  4. (
  5. [quantity] => 10
  6. [price] => 9.99
  7. )
  8.  
  9. [1] => Array
  10. (
  11. [quantity] => 25
  12. [price] => 8
  13. )
  14.  
  15. [2] => Array
  16. (
  17. [quantity] => 50
  18. [price] => 6
  19. )
  20.  
  21. [3] => Array
  22. (
  23. [quantity] => 100
  24. [price] => 4
  25. )
  26.  
  27. <form>
  28. <input type="text" name="quantity" placeholder="Quantity" />
  29. <input type="text" name="price" placeholder="Costing" readonly />
  30. <input type="submit" name="submit" value="Show Cost" />
  31. </form>
  32.  
  33. $data['wholesalePrices'] =
  34. array(
  35. 'quantity' => 10, 'price' => 9.99,
  36. 'quantity' => 25, 'price' => 8,
  37. 'quantity' => 50, 'price' => 6,
  38. 'quantity' => 100, 'price' => 4
  39. );
  40. $qty = $_POST['quantity'];
  41.  
  42. if(in_array($qty , $data['wholesalePrices'])) {
  43. echo "price exist";
  44. } else {
  45. echo "Not Matched";
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement