Forum Moderators: coopster
$Display = 10;
I've put a simple input field on the page, to change the number of entries displayed, according to my needs, and that is no problem:
<form name="changedisplay" action="admin.php?page=viewlog" method="post">
Choose entries per page: <input name="DisplayValue" type="text" value="$Display" size="10" maxlength="3">
<input type="submit" name="Change" value="Change">
</form>
if (isset($_POST['Change'])) {
$Display = $_POST['DisplayValue'];
} else {
$Display = 10;
}
But obviously, once I leave the page, the value of $Display goes back to the default one. What I want to do is to store permanently the new value, by overwriting the default one.
How can I do this, without having to overwrite the whole page but only the value of the single variable? Is it possible?
I know I can do this simply (and I know how to do it) by moving the $Display variable to a file outside of "entries.php", but it's a pity for only 1 configuration variable. And I'm also curious...
Looking forward to some good news, I thank you for the help
HughMungus is spot on. Each user might have a different value, so setting a cookie [php.net] is probably the best option.
<?php
variable1 = 10;
variable2 = 33;
variable3 = 178;
?>
if (isset($_POST['submit'] {
$handle = fopen("settings.php", "r+") //is r+ correct?
//then find the "variable2"
//then change the value from 33 to 112
fclose ($handle);
}
Thanks a lot for your help