Exclude some variables from looping

php

#1

I have this code , I want to stop looping of some variables and let other variable looping

the variables that I do not them to loop are :
$heading1 , $heading2 , $heading3

the variables that I want them to loop are :
$divstable, $divname

any I advice ,
I tried many ways ,but did not work with me ( it’s beyond my scope)

<?php
/*
Actually edit and possibly add a division
*/

    $confid = intval($_POST['conf']);
    
    if ($is_admin || full_check('manage_div') || permissions_check ('manage_div',$confid)) {
    
        $numdivs = count($_POST['divid']);

        for ($i=0;$i<$numdivs;++$i) {
             $heading1 = htmlspecialchars($_POST['heading1'][$i], ENT_QUOTES);
             $heading2 = htmlspecialchars($_POST['heading2'][$i], ENT_QUOTES);
             $heading3 = htmlspecialchars($_POST['heading3'][$i], ENT_QUOTES);
             $divstable = htmlspecialchars($_POST['divstable'][$i], ENT_QUOTES);
             $divname = htmlspecialchars($_POST['divname'][$i], ENT_QUOTES);

            $divid = intval($_POST['divid'][$i]);
             $divorder = intval($_POST['divorder'][$i]);
                
            // Double-check that they didn't falsify the posted conference ID
            $query = 'SELECT conference FROM sportsdb_divs WHERE divid = ' . $divid;
            $result = mysql_query($query);
            $confid_check = mysql_result($result,0);
            if ($confid_check != $confid) {
                die ($text_no_perm);
            }
            
           // Update!
            $query = "UPDATE sportsdb_divs SET heading1 = '$heading1', heading2 = '$heading2', heading3 = '$heading3', divstable = '$divstable',divname = '$divname', divorder = $divorder WHERE divid = $divid LIMIT 1";
        	mysql_query($query) or die ("Error in query $query");
        	print "<p>Divisions updated.</p>";
        }

this another code could be help

print " heading1:<input type=\"text\" name=\"heading1[$i]\" size=\"30\" maxlength=\"80\" value=\"$heading1\" /><br />\n";
            print "heading2: <input type=\"text\" name=\"heading2[$i]\" size=\"30\" maxlength=\"80\" value=\"$heading2\" /><br />\n";
            print "heading3: <input type=\"text\" name=\"heading3[$i]\" size=\"30\" maxlength=\"80\" value=\"$heading3\" /><br<br />\n";         		
             print "Division name: <input type=\"text\" name=\"divname[$i]\" size=\"30\" maxlength=\"60\" value=\"$divname\" /><br />\n";
            print "Division order: <input type=\"text\" name=\"divorder[$i]\" size=\"2\" maxlength=\"2\" value=\"{$divs['divorder']}\" /></p>\n";
            print "<input type=\"hidden\" name=\"divid[$i]\" value=\"{$divs['divid']}\" />\n";

#2

screenshot for C panel


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.