ID:               23957
 Updated by:       [EMAIL PROTECTED]
 Reported By:      oldiesmann at hotpop dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         Variables related
 Operating System: Red Hat Linux
 PHP Version:      4.3.2
 New Comment:

Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.

...


Previous Comments:
------------------------------------------------------------------------

[2003-06-02 10:19:36] oldiesmann at hotpop dot com

I have been trying for a couple of weeks to get these functions to
work. The functions are part of a mod for YaBB SE that displays user
selectable moods on the board. The admin is supposed to be able to
update/reorder these moods using the following code, however, it won't
update the values. It appears that the $HTTP_POST_VARS aren't being
updated, almost as if it loses all the info that the user has just
entered as soon as you submit the changes. I've tried several different
ways of doing this (do...while, even a for loop using
mysql_count_rows), and it won't work. Here's a little extra info as to
what the variables are - $moodtxt is the variable for the array of text
strings that go along with this mod. The $color stuff is set in the
template. $cgi is 'index.php?board='. All of the action variables are
set in an array in the main index.php file (I've got it set to go to
the ModifyMoods2() function when it sees "action=modifymoods"). Also,
$db_prefix is set in the settings file - this is the database table
prefix. $imagesdir is the url for the images directory for the board.

Here's the code:

function ModifyMoods() { 
   global $db_prefix, $moodtxt, $imagesdir, $cgi, $yytitle, $id,
$HTTP_POST_VARS; 
    
        is_admin(); 
   $yytitle = $moodtxt[8]; 
   template_header(); 
    
   $get_moods = mysql_query("SELECT * FROM {$db_prefix}moods ORDER BY
oid ASC"); 
   echo ' 
   <form action="' . $cgi . ';action=modifymoods" method="POST"> 
   <table border="1" width="100%" cellspacing="0" cellpadding="0"
bgcolor="' . $color['bordercolor'] . '" class="bordercolor"
align="center"> 
   <tr> 
                <td valign="middle" align="left" class="titlebg"
bgcolor="' . $color['titlebg'] . '" colspan="5" height=22> <img src="'
. $imagesdir . '/grin.gif" /> </td> 
      <td valign="middle" align="center" class="titlebg" bgcolor="' .
$color['titlebg'] . '" width="100%" height=22><b><font size="2"
class="text1" color="' . $color['titletext'] . '">' . $moodtxt['1'] .
'</font></b></td> 
   </tr></table> 
        <table border="0" width="100%" cellspacing="1" cellpadding="1"
bgcolor="' . $color['bordercolor'] . '" class="bordercolor"
align="center"> 
   <tr> 
      <td class="catbg" bgcolor="' . $color['catbg'] . '" width="30%"
align="center">' . $moodtxt['6']. '</td> 
      <td class="catbg" bgcolor="' . $color['catbg'] . '" width="30%"
align="center">' . $moodtxt['7'] . '</td> 
      <td class="catbg" bgcolor="' . $color['catbg'] . '" width="30%"
align="center">' . $moodtxt['13'] . '</td> 
      <td class="catbg" bgcolor="' . $color['catbg'] . '" width="30%"
align="center">Mood Image</td> 
      <td class="catbg" bgcolor="' . $color['catbg'] . '" width="10%"
align="center"></td> 
   </tr>'; 

        $i = 1; 
   while ($mood = mysql_fetch_row($get_moods)) { 
      echo ' 
      <tr> 
         <td class="windowbg" bgcolor="' . $color['windowbg'] . '"
width="30%" align="center"><input type="text" name="name$i" value="' .
$mood[1] . '"></td> 
         <td class="windowbg" bgcolor="' . $color['windowbg'] . '"
width="30%" align="center"><input type="text" name="fn$i" value="' .
$mood[2] . '"></td> 
         <td class="windowbg" bgcolor="' . $color['windowbg'] . '"
width="30%" align="center"><input type="text" name="oid$i" value="' .
$mood[3] . '"></td> 
         <td class="windowbg" bgcolor="' . $color['windowbg'] . '"
width="30%" align="center"><img src="' . $imagesdir . '/' . $mood[2] .
'" alt="' . $mood[1] . '"></td>'; 
          
         if ($MenuType == 1) { echo' <td class="windowbg" bgcolor="' .
$color['windowbg'] . '" width="10%" align="center"><a
href="index.php?action=deletemood;id=' . $mood[0] . '">' .
$moodtxt['14'] . '</a></td>';} 
              else { echo' <td class="windowbg" bgcolor="' .
$color['windowbg'] . '" width="10%" align="center"><a
href="index.php?action=deletemood;id=' . $mood[0] . '"><img src="' .
$imagesdir . '/delete.gif" border=0 /></a></td>'; } 
      echo'</tr>'; 
      $i++; 
      } 
   echo ' 
   <tr> 
   <td class="catbg" bgcolor="' . $color['catbg'] . '" align="center"
colspan="5"> 
   <input type="submit" value="Modify Moods"> 
   <br /></td></tr></table> 
   </form>'; 
   footer(); 
        obExit(); 
} 

function ModifyMoods2() { 
   global $db_prefix, $imagesdir, $HTTP_POST_VARS, $id, $oid, $name,
$fn; 

   $i = 1; 
   $get_moods = mysql_query("SELECT * FROM {$db_prefix}moods WHERE
(id='$id')"); 

   while ($mood = mysql_fetch_row($get_moods)) { 
                            if(isset($HTTP_POST_VARS["name$i"])){ 
                                if(isset($HTTP_POST_VARS["fn$i"])){ 
                                  if(isset($HTTP_POST_VARS["oid$i"])){

               $name[$i] = $HTTP_POST_VARS["name$i"]; 
               $fn[$i] = $HTTP_POST_VARS["fn$i"]; 
               $oid[$i] = $HTTP_POST_VARS["oid$i"]; 
                
               $result = mysql_query("   UPDATE {$db_prefix}moods 
                        SET
name='$name[$i]',filename='$fn[$i]',oid='$oid[$i]' 
                        WHERE (id='$id')");                
               } 
            } 
         } 
      $i++; 
      } 
   ModifyMoods(); 
   }

------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=23957&edit=1

Reply via email to