Advertisement
Guest User

Untitled

a guest
Apr 6th, 2020
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.75 KB | None | 0 0
  1. <?php
  2. session_start();
  3. $tombbe_mentes = [];
  4.  
  5. foreach($_SESSION["kosar"] as $index => $value) {
  6.     //echo "tomb[" . $index . "] => " . $value . " \n";
  7. $darabszam = $value['darabszam'];
  8.     array_push($tombbe_mentes_kosar, $value);
  9.     $_SESSION["kosar"] = $tombbe_mentes;
  10.     //var_dump($value);
  11. // Érték kinyerése a tömbből:
  12. $ertek = $value['termekazonosito'];
  13.  //echo $ertek;
  14.  
  15.  
  16.  
  17. echo $darabszam;
  18.  
  19. $session_azonosito_kivett = $_SESSION['userazonosito'];
  20.  
  21.  
  22. $sql = "SELECT * FROM termek WHERE  azonosito = $ertek";
  23. $eredmeny1 = mysqli_query($conn,$sql);
  24. while($sor = mysqli_fetch_assoc($eredmeny1)){
  25.     $termek_azonosito = $sor['termekazonosito'];
  26.     $kepneve = $sor['elsokep'];
  27.     $leiras = $sor['leiras'];
  28.     $ar = $sor['ar'];
  29.     $replaceelt_leiras = str_replace('_', ' ', $leiras);
  30.     $replaceelt = str_replace('_', '.', $kepneve);
  31.  
  32.  
  33.  
  34. }
  35.  
  36. ?>
  37. <div style="width: 200px; height: 300px; margin-top: 50px; ">
  38.     <i onclick="felugro();"  class="fa fa-trash-o" id="torlogomb" style="font-size:40px;color:red; z-index: 1; margin-left: 100px; margin-bottom: 150px;" value="<?php echo $ertek;  ?>"></i>
  39.     <input type="hidden" name="" id="rejtett"  value="<?php echo $ertek;  ?>">
  40.     <div style=" width: 80%; height: 200px; margin-top: -300px; font-size:30px; margin-left: 80px;">
  41.         <?php
  42.         echo"
  43.         <div style='font-size:15px; margin-left:50px;margin-top:20px;z-index: -1;'>$replaceelt_leiras</div>
  44.  
  45.         ";
  46. echo "<img style='width:90px; height:150px;float: left; margin-top:-5px; margin-left:-60px; border:0.8px solid black;' src='kezelofelulet/kepek/{$kepneve}'>
  47.  
  48.  
  49. ";
  50.         ?>
  51. <div style='z-index:1; margin-left:210px; font-size:20px; letter-spacing:1px; display:inline-block; margin-top: 45px;'><strong><?php echo $ar."FT";?></strong></div>
  52.  
  53.     </div>
  54.  
  55. <div style="width: 18px; height: 18px; background-color: white;margin-top: 10px; border:1px solid black; margin-left: 25px;">    
  56. </div>
  57. <div style="width: 20px; height: 20px; background-color: pink; margin-top: -20px; margin-left: 50px;">  
  58. </div>
  59. <div style="width: 20px; height: 20px; background-color: #5999d9;margin-left: 76px; margin-top: -20px;">    
  60. </div>
  61.  
  62.  
  63.  
  64.  
  65. <div id="valtozo1" onclick="divszinezes();" style="width: 20px; height: 20px; background-color: white;margin-left: 105px; margin-top: -20px;border:0.5px solid black;">
  66. <p style="font-size: 10px; margin-left: 5px; margin-top: 5px;"><strong>XS</strong></p>  
  67. </div>
  68. <div id="valtozo2" onclick="divszinezes2();" style="width: 20px; height: 20px; background-color: white;margin-left: 133px; margin-top: -21px;border:0.5px solid black;">
  69. <p style="font-size: 10px; margin-left: 8px; margin-top: 5px;"><strong>S</strong></p>    
  70. </div>
  71. <div id="valtozo3" onclick="divszinezes3();" style="width: 20px; height: 20px; background-color: white;margin-left: 160px; margin-top: -20px;border:0.5px solid black;">
  72. <p style="font-size: 10px; margin-left: 5px; margin-top: 5px;"><strong>M</strong></p>    
  73. </div>
  74. <div id="valtozo4"  onclick="divszinezes4();" style="width: 20px; height: 20px; background-color: white;margin-left: 190px; margin-top: -21px;border:0.5px solid black;">
  75. <p style="font-size: 10px; margin-left: 8px; margin-top: 5px;"><strong>L</strong></p>    
  76. </div>
  77. <div id="valtozo5" onclick="divszinezes5();" style="width: 20px; height: 20px; background-color: white;margin-left: 220px; margin-top: -20px;border:0.5px solid black;">
  78. <p style="font-size: 10px; margin-left: 5px; margin-top: 5px;"><strong>XL</strong></p>   
  79. </div>
  80. <div style=" background-color: white;margin-left: 250px; margin-top: -25px;">  
  81. <select style="width: 30px; height: 30px; font-size: 15px; z-index:99;" class="frissites" onclick="updatekosar();">
  82.     <option  value="1">1</option>
  83.     <option  value="2">2</option>
  84.     <option  value="3">3</option>
  85.     <option  value="4" >4</option>
  86.    
  87. </select>
  88. </div>
  89. </div>
  90. <?php
  91. }
  92. ?>
  93.  
  94.  
  95. <script>
  96.     function updatekosar(){
  97.  
  98. var termekazonosito_update = '<?php  echo $_SESSION['termekazonosito'];  ?>';
  99. $('.frissites').on('click', function() {
  100.   var value = $(this).val();
  101.   var value_tovabb = value;
  102.     $.ajax({
  103.                
  104.     url:"test.php",
  105.     method:"POST",
  106.     data:{valtozo_update:value_tovabb, termekazonosito_update:termekazonosito_update},
  107.         success:function()
  108.                 {
  109.                     console.log($.ajax());
  110.  
  111.       //termekazonosito_update.remove();
  112.                     //location.reload();
  113.                     //alert(value_tovabb+"Darabszám frissítve");
  114.                 }
  115.             })
  116.  
  117. });
  118. }  
  119. </script>
  120.  
  121.  
  122. <!--*************************************************Legalul a test.php kódja látható: ************************************  -->
  123.  
  124. if(!empty($_POST)){
  125.    
  126.        
  127. foreach($_SESSION["kosar"] as $index => $value) {
  128.                
  129.  if($_SESSION['kosar'][$index]['termekazonosito'] == $_POST['termekazonosito_update']){
  130.            
  131. $_SESSION['kosar'][$index]['darabszam'] = $_POST["valtozo_update"];
  132.             }
  133.         }
  134.             }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement