Log in

View Full Version : $per_page modification



cssmaster
02-20-2008, 10:57 PM
Hi, I need some help with the following issue.
I created a comment system with an administrator panel, where I can modify the site name, comments per page, etc. In the settings file I have the $per_page command which is as follows:

$per_page = 5;

In another file called general.php, I try to modify the value of $per_page in a textbox. The code is as follows:

<input class="input" name="per_page" id="per_page" tabindex="2" value="<?php echo "$per_page"; ?>" /></span></p>


As for the submit, I have as follows:


<?php
if(isset($_POST['submit'])) {

$per_page = $_POST["$per_page"];

$per_page = SafeAddSlashes($per_page);

header("Location: http://$SERVER_NAME$REQUEST_URL");
}
?>

I know I can use the fopen command to open the file however, what do I need to do exactly to be able to modify the $per_page value from another file?
Kind Regards.

alexjewell
02-22-2008, 12:34 AM
You want to use explode.

http://www.tizag.com/phpT/php-string-explode.php
http://us.php.net/explode
http://www.w3schools.com/php/func_string_explode.asp

cssmaster
02-24-2008, 01:21 AM
Thanks for your help.
Kind Regards