Hi,
I have upgraded linux server, along with that i installed PHP 5. Now I am trying to make PHP4 code work under PHP5. I am not a programmer, i am a sysadmin trying figure out some stuff. I found about register_globals=off and modified lot of PHP4 code to work under PHP5, this one program which is making go crazy:
below is part of program which generates FORM
<?php
require("modules/dbconf.php");
$email = $_POST['email'];
$profilequery = "SELECT * FROM dblalerts WHERE customerid = '$customerid' AND email = '$email'";
$result = mysql_query($profilequery, $a);
while($profile = mysql_fetch_object($result)) {
if (! $updateerror) {
$disabled = $profile->disabled;
$pid = $profile->pid;
$dbname = $profile->dbname;
$email = $profile->email;
} else {
$pid = $profile->pid;
$disabled = "disabled_" . $pid; $disabled = $$disabled;
$dbname = "dbname_" . $pid; $dbname = $$dbname;
}
if ($disabled) { $checked = "checked"; } else { $checked = ""; }
?>
<!-- HTML -->
<tr><td width=15></td><td align=left><input type="checkbox"
name="disabled_<?php echo $pid; ?>"
value="Y" <?php echo $checked; ?>></td>
<td align=left><input type="text" name="dbname_<?php echo $pid; ?>"
value="<?php echo $dbname; ?>" size=16></td>
<td align=left><a href="delete.php?pid=<?php echo $pid; ?>&email=<?php echo $email; ?>">Delete</a></td>
</tr><br>
<!-- END HTML-->
<?php
}
?>
After clicking Update, following program is called
<?php
// MYSQL UPDATE PROGRAM
$email = $_POST['email'];
$customerid = getenv("REMOTE_USER");
$profilequery = "SELECT * FROM dblalerts WHERE customerid = '$customerid'";
$result = mysql_query($profilequery, $a);
while($profile = mysql_fetch_object($result)) {
$pid = $profile->pid;
$usermail = $profile->email;
if ($usermail == $email) {
$disabled = "disabled_$pid"; $disabled = $$disabled;
$dbname = "dbname_" . $pid; $dbname = $$dbname;
$dbname = strtolower($dbname);
$query = "UPDATE dblalerts SET disabled='$disabled', email='$email',dbname='$dbname' WHERE pid = '$pid'";
$updateres = mysql_query($query, $a);
if (! $updateres) {
$problem = "One or more profile updated failed. If this problem
persists, please contact the customer support
<a href=\"mailto:support@my.com\">helpdesk</a>";
}
}
}
?>
How do i make the values from within HTML tag above passed on to DB UPDATE program?
What does this mean in the above program
$dbname = "dbname_" . $pid; $dbname = $$dbname;
Thanks
phshss