Jump to content

salgergawi

Members
  • Posts

    12
  • Joined

  • Last visited

Everything posted by salgergawi

  1. I have a problem if anyone can helps, HTML FORM <html> <body> <form action=""><input type="checkbox" name="" id="cbB0000F0S1" onchange="changestatus('B0000F0S1',this.checked)"><input type="checkbox" name="" id="cbB0000F0S2" onchange="changestatus('B0000F0S2',this.checked)"><input type="checkbox" name="" id="cbB0000F0S3" onchange="changestatus('B0000F0S3',this.checked)"><input type="checkbox" name="" id="cbB0000F0S4" onchange="changestatus('B0000F0S4',this.checked)"><input type="checkbox" name="" id="cbB0000F0S5" onchange="changestatus('B0000F0S5',this.checked)"><input type="checkbox" name="" id="cbB0000F0S6" onchange="changestatus('B0000F0S6',this.checked)"><input type="checkbox" name="" id="cbB0000F0S7" onchange="changestatus('B0000F0S7',this.checked)"><input type="checkbox" name="" id="cbB0000F0S8" onchange="changestatus('B0000F0S8',this.checked)"><input type="checkbox" name="" id="cbB0000F0S9" onchange="changestatus('B0000F0S9',this.checked)"><input type="checkbox" name="" id="cbB0000F0S10" onchange="changestatus('B0000F0S10',this.checked)"><input type="checkbox" name="" id="cbB0000F0S11" onchange="changestatus('B0000F0S11',this.checked)"><input type="checkbox" name="" id="cbB0000F0S12" onchange="changestatus('B0000F0S12',this.checked)"><input type="checkbox" name="" id="cbB0000F0S13" onchange="changestatus('B0000F0S13',this.checked)"><input type="checkbox" name="" id="cbB0000F0S14" onchange="changestatus('B0000F0S14',this.checked)"><input type="checkbox" name="" id="cbB0000F0S15" onchange="changestatus('B0000F0S15',this.checked)"><input type="checkbox" name="" id="cbB0000F0S16" onchange="changestatus('B0000F0S16',this.checked)"><input type="checkbox" name="" id="cbB0000F0S17" onchange="changestatus('B0000F0S17',this.checked)"><input type="checkbox" name="" id="cbB0000F0S18" onchange="changestatus('B0000F0S18',this.checked)"><input type="checkbox" name="" id="cbB0000F0S19" onchange="changestatus('B0000F0S19',this.checked)"><input type="checkbox" name="" id="cbB0000F0S20" onchange="changestatus('B0000F0S20',this.checked)"></form> </body> </html> Jquery Code: function changestatus(str,checked){ $("input[type=checkbox][id*="+str+"]").each(function(){ o=this; if(o.id) if(o.id.indexOf(str)!=-1) { eval("e=document.getElementById('"+o.id+"')"); if(!e.disabled) e.checked=checked; } }) } my problem is when i select the first checkbox is aoutomatlicy the others check as you can see in the image, the first has ID=1 and the others has ID=11, 12, 13 and so on, how can remove and use only the exact id? This is also an online sample: https://codepen.io/akerr95/pen/ZGyZmv
  2. I do not know what is wrong: it is printing:- $remains= ($country->country_unit) - ($country->sold_units) ; however i have not written echo only inside the tag <td> echo $remains; <?= $remains= ($country->country_unit) - ($country->sold_units) ; if($remains<300 && $remains!=0){ ?> <td style="text-align: center; background-color: darkred; color: wheat"> <?php } else { ?> <td style="text-align: center"> <?php } echo $remains; ?> </td> what is wrong why is the variable printing its result alone?
  3. Thank you very much, works perfect, and thank you for your advise on the replay above ...
  4. @dsonesuk i have added this code but still geting all record in one block how can i get them geting in them looping one each other, please look at the image here is the part of the code: the class name is the CSS class="marquee" <div class="marquee"> <p class="marquee"> <?php if($reginoal_own_units<>0){ $total_regional_units +=$reginoal_own_units; $count++; if($reginoal_own_units==1){ echo "you have ". $reginoal_own_units . " unit, ". $countryname ." and your revenue : ".round($regional_calc,0); }else{ echo "you have ". $reginoal_own_units . " units, ". $countryname ." and your revenue : ".round($regional_calc,0); } ?> </p> </div> how can i get them in a row, keep noting please these echo comes out from foreach loop.
  5. Could you please give me a hint how to do it?
  6. I want to let the data shows in marquee but it shows only one record which is coming from foreach loop. this par of code is show about 60 rows by foreach loop: <?php if($reginoal_own_units<>0){ $total_regional_units +=$reginoal_own_units; $count++; if($reginoal_own_units==1){ $marq1= "you have ". $reginoal_own_units . " unit, ". $countryname ." and your revenue : ".round($regional_calc,0); }else{ $marq2= "you have ". $reginoal_own_units . " units, ". $countryname ." and your revenue : ".round($regional_calc,0); } ?> The HTML tag is the folowing out of the foreach loop: <marquee bgcolor="lightblue" width="100px" hight="10px"> <?php echo $marq1 . " " . $marq2; ?> </marquee>
  7. i think is correct the logic like this but is not working
  8. how can i add a breack line using for loop in an foreach i have written this code but i know it is wrong <?php if($reginoal_own_units<>0){ $total_regional_units +=$reginoal_own_units; $count++; for ($i = 0; $i <= count($countries); $i+=3) { if ($i % 3 == 0){ $break_line = "<br>"; } } echo $countryname . " ( " .$reginoal_own_units . " ) ".round($regional_calc,0)."" . $break_line; } ?>
  9. Thank you found it foreach( $calculations as $key =>$calculation ) { // added a key in foreach if(isset($_GET['own_pools'])){ $own_pools=(int)$_GET['own_pools'][$key]; // and here added the key $global_calc=($own_pools * (int)$calculation['Calculation']['total_units']); $sum_main_pools +=$global_calc; }
  10. Thanks for our replay, that means i have to add it in a for loop because is about 4 elements? and should it be inside the foreach or how to deal with this?
  11. <input name="own_pools[]" type="text" value="'.$own_pools.'" id="own_pools" maxlength="5" size="5" > when i print using: `var_dump($_GET["own_pools"]);` I get array(4) { [0]=> string(1) "5" [1]=> string(3) "300" [2]=> string(3) "280" [3]=> string(2) "50" } the parameters in the link are showing correctly index?own_pools[]=5&own_pools[]=300&own_pools[]=280&own_pools[]=50&visitor_expect=100000000&ticket_price=15&submit_calc=Calculate but after that the values did not get the right data back in the form and shown like this: [![Please view the photo ][1]][1] How can I get it calculated and get the values correctly from the input and returned the entered values back to the input value. I have searched and read but couldn't find the answer... I have the following code ``` <?php $ticket_price=0; $visitor_expect=0; $total_value=0; $own_pools=0; $pool_result=0; if(isset($_GET['submit_calc']) && isset($_GET['own_pools'])) { $ticket_price = $_GET['ticket_price']; $visitor_expect =$_GET['visitor_expect']; $own_pools=$_GET['own_pools']; if(is_numeric($ticket_price) && is_numeric($visitor_expect)){ // pools calculations $rev_visitors=((int)$_GET["visitor_expect"]* (int)$_GET["ticket_price"]); $total_value=($rev_visitors*0.01)*30; $pool_result = $total_value ; } } ?> <form action="" method="get" > <table> <tr> <?php // Display headers in one row as colmun $tds = ''; $sum_main_pools=0; foreach( $calculations as $index =>$calculation ) { ?> <th> <?php echo $calculation['Calculation']['poolname']; ?> </th> <?php // create TDs for the values if ($calculation['Calculation']['poolname']<>"Regional Pool"){ $tds .= '<td> <div class="input text" id="pool_calc"> ' . $calculation['Calculation']['total_units'] . ' <input name="own_pools[]" type="text" value="'.$own_pools.'" id="own_pools" maxlength="5" size="5" > </div> </td>'; if(isset($_GET['own_pools'])){ $own_pools=(int)$_GET['own_pools']; $global_calc=($own_pools * (int)$calculation['Calculation']['total_units']); $sum_main_pools +=$global_calc; } } else { $tds .= '<td> ' . $calculation['Calculation']['total_units'] . ' </td>'; } } var_dump($_GET["own_pools"]); ?> </tr> <tr> <?php // Printing the values echo $tds; ?> </tr> </table> <?php $pool_result = $total_value + $sum_main_pools; ?> <table> <tr> <td style="width: 30%"> <div class="input text" id="pool_calc"> Expected Visitors per day <input name="visitor_expect" type="text" value="100000000" id="visitor_expect" maxlength="9" size="9" > </div> </td> <td style="width: 30%"> <div class="input text" id="pool_calc"> Ticket Price <input name="ticket_price" type="text" value="15" id="ticket_price" maxlength="2" size="3" > </div> </td> </tr> <tr > <td style="width: 60%"> <div> <label > <?php echo (isset($pool_result) ? $pool_result : "");?></label> <input name="submit_calc" type="submit" value="Calculate" id="submit_calc"> </div> </td> </tr> </table> </form> ```
×
×
  • Create New...