Bug #17649 Updated: Scope bug, variable doesn't die as it should
| From: | sniper@php.net | Date: | Sat, 08 Jun 2002 03:29:32 +0000 |
| Subject: | Bug #17649 Updated: Scope bug, variable doesn't die as it should | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-9813@lists.php.net to get a copy of this message | ||
ID: 17649
Updated by: sniper@php.net
Reported By: scarlac2000@hotmail.com
-Status: Open
+Status: Bogus
Bug Type: Variables related
Operating System: Windows NT 5 (windows 2000 Pro)
PHP Version: 4.2.1
New Comment:
Sorry, but the bug system is not the appropriate forum for asking
support questions. 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
Thank you for your interest in PHP.
Previous Comments:
------------------------------------------------------------------------
[2002-06-07 18:35:42] scarlac2000@hotmail.com
The problem:
PHP doesn't seem to kill my variable ($allow) correctly.
I dunno if i'm just to tired, it's 30 min past midnight, so bare with
me. I just found out and consulted another reliable guy, he just told
me to get used to it.. I thought it would be good if you guys knew.
My Setup:
Normal Win32 setup, no changes to standart php.ini, running apache
1.3.24.
database content:
mysql> select * from permission_table
+----+------------+---------+-------+
| id | actiontype | groupid | allow |
+----+------------+---------+-------+
| 1 | changenews | 0 | 0 |
| 2 | changenews | 5 | 1 |
| 6 | changenews | 4 | 0 |
+----+------------+---------+-------+
------ SCRIPT START ------
<?
include("root.php");
include("$root/dbopen.php");
mysql_select_db("spacenet");
$res = mysql_query("SELECT * FROM permission_table") or
die(mysql_error());
?>
<script language="JavaScript">
<!--
function setvars(allow,id)
{
document.perm_form.allow.value=allow;
document.perm_form.id.value=id;
}
//-->
</script>
<form name="perm_form" action="./func_change_permission.php"
method="post">
<table border="1" summary="permissions">
<tr>
<td>id</td>
<td>groupid</td>
<td>actiontype</td>
<td>allow</td>
<td colspan="2"> </td>
</tr>
<?
while($row = mysql_fetch_array($res))
{
echo "<tr>\n";
echo "\t<td>$row[0]</td>\n";
echo "\t<td>".$row["groupid"]."</td>\n";
echo "\t<td>$row[1]</td>\n";
if($row["allow"]=="1")
$allow = "checked";
else // this else is essential, without it, PHP forgets to reset
(kill) $allow, so $allow is always = "checked"
$allow = "";
echo "\t<td><input type=\"checkbox\" value=\"1\"
name=\"val_$row[id]\" $allow >".$row["allow"]."</td>\n";
echo "\t<td><a
href=\"func_remove_permission.php?id=$row[0]\">[fjern]</a></td>\n";
echo "\t<td><a href=\"#\"
onclick=\"setvars(document.perm_form.val_$row[id].checked,$row[id]);document.perm_form.submit()\">[Gem]</a></td>\n";
echo "</tr>\n";
}
?>
</table>
<input type="hidden" value="<?=mysql_num_rows($res)?>"
name="num_rows">
<input type="hidden" value="" name="allow">
<input type="hidden" value="" name="id">
<input type="submit" value="Gem" title="Gem ændringer">
</form>
<form action="./func_add_permission.php" method="post">
<b>Add permissions:</b>
<table border="0">
<tr>
<td>Actiontype: </td><td><input type="text"
name="actiontype"
value=""></td>
</tr>
<tr>
<td>Allow: </td><td><input type="checkbox" name="allow"
value="1"
></td>
</tr>
<tr>
<td>Group ID: </td><td><input type="text" name="groupid"
value=""
></td>
</tr>
</table>
<input type="submit" value="Gem" >
</form>
<?
include("$root/dbclose.php");
?>
------ END OF SCRIPT -------
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=17649&edit=1