?

Search Help Board

PHP FAQ
PHP Articles
PHP Help
Bulletin Board

PHP Manual (NEW!)
First Time PHP'ers
Help with programming
Sql assignment help
PHP Homework Help


C# Help

?
?$HTTP_POST_VARS not being updated
Author:??(---.natpool.uc.edu)
Date:???06-04-03 07:54

Hi. I have been racking my brain for the past few weeks trying to figure out why the code below won't update the $HTTP_POST_VARS values. This is part of a mod for YaBB SE, so I will explain what some of the variables are:

$db_prefix - database table prefix - defined in settings.php
$cgi - "index.php?board="
$moodtxt - text variables for this mod
$id - auto-incrementing ID associated with each mood
$yytitle - variable that sets the title for that particular section of the board
$imagesdir - variable that contains the URL of the image directory for the board.

As for the action, this is defined in the main index.php file. It stores all the action variables in a giant array, and points each "action" to a particular function in a certain file. In this case, "modifymoods" takes you to the ModifyMoods2() function. I have tried several different ways of doing this, and it won't update the values. It will get them just fine, but it doesn't pick up the changes...

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 '





' . $moodtxt['1'] . '








';

$i = 1;
while ($mood = mysql_fetch_row($get_moods)) {
echo '




';

if ($MenuType == 1) { echo' ';}
else { echo' '; }
echo'';
$i++;
}
echo '

' . $moodtxt['6']. ' ' . $moodtxt['7'] . ' ' . $moodtxt['13'] . ' Mood Image
' . $mood[1] . ' ' . $moodtxt['14'] . '




';
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($HTTP_POST_VARS["name$i"] != ""){
if($HTTP_POST_VARS["fn$i"] != ""){
if($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();
}

?Topics Author? Date
?$HTTP_POST_VARS not being updated??new
Oldiesmann 06-04-03 07:54?
Go to Top??|??Go to Topic??|??Flat View??|??Search?
??|??
New Topic
?Reply To This Message
?Your Name:
?Your Email:
?Subject:
Email replies to this thread, to the address above.
??wrote: > > Hi. I have been racking my brain for the past few weeks > trying to figure out why the code below won't update the > $HTTP_POST_VARS values. This is part of a mod for YaBB SE, so > I will explain what some of the variables are: > > $db_prefix - database table prefix - defined in settings.php > $cgi - "index.php?board=" > $moodtxt - text variables for this mod > $id - auto-incrementing ID associated with each mood > $yytitle - variable that sets the title for that particular > section of the board > $imagesdir - variable that contains the URL of the image > directory for the board. > > As for the action, this is defined in the main index.php > file. It stores all the action variables in a giant array, > and points each "action" to a particular function in a > certain file. In this case, "modifymoods" takes you to the > ModifyMoods2() function. I have tried several different ways > of doing this, and it won't update the values. It will get > them just fine, but it doesn't pick up the changes... > > 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 ' >
method="POST"> > cellpadding="0" bgcolor="' . $color['bordercolor'] . '" > class="bordercolor" align="center"> > > > >
class="titlebg" bgcolor="' . $color['titlebg'] . '" > colspan="5" height=22> /> bgcolor="' . $color['titlebg'] . '" width="100%" > height=22>' . $moodtxt['1'] . '
> cellpadding="1" bgcolor="' . $color['bordercolor'] . '" > class="bordercolor" align="center"> > > > > > > > '; > > $i = 1; > while ($mood = mysql_fetch_row($get_moods)) { > echo ' > > > > > '; > > if ($MenuType == 1) { echo' ';} > else { echo' '; } > echo''; > $i++; > } > echo ' > >
width="30%" align="center">' . $moodtxt['6']. ' width="30%" align="center">' . $moodtxt['7'] . ' width="30%" align="center">' . $moodtxt['13'] . ' width="30%" align="center">Mood Image width="10%" align="center">
name="name$i" value="' . $mood[1] . '"> name="fn$i" value="' . $mood[2] . '"> name="oid$i" value="' . $mood[3] . '">' . $mood[1] . ' bgcolor="' . $color['windowbg'] . '" width="10%" > align="center">' . $moodtxt['14'] . ' href="index.php?action=deletemood;id=' . $mood[0] . '"> src="' . $imagesdir . '/delete.gif" border=0 />
align="center" colspan="5"> > >
>
'; > 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($HTTP_POST_VARS["name$i"] != > ""){ > if($HTTP_POST_VARS["fn$i"] != > ""){ > if($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(); > } ">??

Provided By
Phorum