Jump to content

salgergawi

Members
  • Posts

    12
  • Joined

  • Last visited

Posts 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?

    firefox_lmK0vPAtiE.png.748490edf4bda9a7b120f448dfd7783e.png

    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. On 12/23/2021 at 6:22 PM, dsonesuk said:
    <!DOCTYPE html>
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
            <meta name="viewport" id="viewport" content="target-densitydpi=high-dpi,initial-scale=1.0" />
            <title>Document Title</title>
            <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
            <script  type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/jquery-ui.min.js"></script>
            <script type="text/javascript">
    
            </script>
            <style type="text/css">
    
                .scroll-left {
                    width: 1200px;
                    height:170px;
                    overflow: hidden;
                    position: relative;
                    background: white;
                    color: black;
                    border: 1px solid orange;
                    margin: 0 auto;
                }
    
                .scroll-left p {
                    position: absolute;
                    width: auto;
                    height: 100%;
                    font-size:150px;
                    line-height: 170px;
                    margin: 0;
                    text-align: center;
                    white-space:nowrap;
                    padding-right: 100%;
                    padding-left:25%;
                    /* Starting position */
    
                    top: 0;
                    left:100%;
    
                    -moz-transform: translateX(0);
                    -webkit-transform: translateX(0);
                    transform: translateX(0);
                    /* Apply animation to this element */
    
                    -moz-animation: scroll-left 13s linear infinite;
                    -webkit-animation: scroll-left 13s linear infinite;
                    animation: scroll-left 13s linear infinite;/**/
                }
                /* Move it (define the animation) */
    
                @-moz-keyframes scroll-left {
                    0% {
                        -moz-transform: translateX(0);
                    }
                    100% {
                        -moz-transform: translateX(-100%);
                    }
                }
    
                @-webkit-keyframes scroll-left {
                    0% {
                        -webkit-transform: translateX(0);
                    }
                    100% {
                        -webkit-transform: translateX(-100%);
                    }
                }
    
                @keyframes scroll-left {
                    0% {
                        -moz-transform: translateX(0);
                        /* Browser bug fix */
    
                        -webkit-transform: translateX(0);
                        /* Browser bug fix */
    
                        transform: translateX(0);
                    }
                    100% {
                        -moz-transform: translateX(-100%);
                        /* Browser bug fix */
    
                        -webkit-transform: translateX(-100%);
                        /* Browser bug fix */
    
                        transform: translateX(-100%);
                    }
                }
            </style>
        </head>
        <body>
    
            <div class="scroll-left">
                <p>Start - The Quick Brown Fox Jumps over the lazy Dog and barks out Loudly - End</p>
            </div>
    
        </body>
    </html>

     

    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.

    marquee.png

  5. 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>

  6. 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;
        }
    ?>

  7. 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;
                }

  8.     <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>
    ```

    calc.png

×
×
  • Create New...