daily pastebin goal
58%
SHARE
TWEET

addproduct

a guest Jan 20th, 2019 132 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. <script type="text/javascript">
  3. function validateForm()
  4. {
  5. var a=document.forms["addproduct"]["pname"].value;
  6. if (a==null || a=="")
  7.   {
  8.   alert("Pls. Enter the product name");
  9.   return false;
  10.   }
  11. var b=document.forms["addproduct"]["desc"].value;
  12. if (b==null || b=="")
  13.   {
  14.   alert("Pls. Enter the product description");
  15.   return false;
  16.   }
  17.  var c=document.forms["addproduct"]["price"].value;
  18. if (c==null || c=="")
  19.   {
  20.   alert("Pls. enter the price");
  21.   return false;
  22.   }
  23. var d=document.forms["addproduct"]["cat"].value;
  24. if (d==null || d=="")
  25.   {
  26.   alert("Pls Enter the oroduct category");
  27.   return false;
  28.   }
  29.  var e=document.forms["addproduct"]["image"].value;
  30. if (e==null || e=="")
  31.   {
  32.   alert("Pls. browse an image");
  33.   return false;
  34.   }
  35. /*if (c.which!=8 && c.which!=0 && (c.which<48 || c.which>57))
  36.   {
  37.   alert("The input U enter in Quantity field is not valid, only numbers are accepted (ex. 1, 2, 3, 4.......)");
  38.   return false;
  39.   }
  40. if (b.which!=8 && b.which!=0 && (b.which<48 || b.which>57))
  41.   {
  42.   alert("The input U enter in Quantity field is not valid, only numbers are accepted (ex. 1, 2, 3, 4.......)");
  43.   return false;
  44.   }*/
  45. }
  46. </script>
  47.  
  48. <style type="text/css">
  49. <!--
  50. .ed{
  51. border-style:solid;
  52. border-width:thin;
  53. border-color:#00CCFF;
  54. padding:5px;
  55. margin-bottom: 4px;
  56. }
  57. #button1{
  58. text-align:center;
  59. font-family:Arial, Helvetica, sans-serif;
  60. border-style:solid;
  61. border-width:thin;
  62. border-color:#00CCFF;
  63. padding:5px;
  64. background-color:#00CCFF;
  65. height: 34px;
  66. }
  67. -->
  68. </style>
  69. <!--sa input that accept number only-->
  70. <SCRIPT language=Javascript>
  71.       <!--
  72.       function isNumberKey(evt)
  73.       {
  74.          var charCode = (evt.which) ? evt.which : event.keyCode
  75.          if (charCode > 31 && (charCode < 48 || charCode > 57))
  76.             return false;
  77.  
  78.          return true;
  79.       }
  80.       //-->
  81.    </SCRIPT>
  82.  
  83. <form action="addexec.php" method="post" enctype="multipart/form-data" name="addproduct" onsubmit="return validateForm()">
  84.  Product Name<br />
  85.   <input name="pname" type="text" class="ed" /><br />
  86.  Description<br />
  87.     <input name="desc" type="text" id="rate" class="ed" /><br />
  88.  Price<br />
  89.     <input name="price" type="text" id="qty" class="ed" onkeypress="return isNumberKey(event)" /><br />
  90.  Category<br />
  91.     <select name="cat" class="ed">
  92.    
  93. <?php
  94.     include('db.php');
  95.     $r = mysql_query("select * from category");
  96.     while($row = mysql_fetch_array($r)){
  97.          echo '<option>'.$row['title'].'</option>';
  98.     }
  99. ?>
  100.   </select>
  101.  
  102.    
  103.  Room Image: <br /><input type="file" name="image" class="ed"><br />
  104.  
  105.     <input type="submit" name="Submit" value="save" id="button1" />
  106.  
  107. </form>
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