Re: refreshing an included php file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



AndreaD wrote:
> I have a file, index.php and this has an included file, lets call it
> calculate.php. When I insert values in text boxes and hit submit the values
> are written as cookies. The question is how can I refresh calculate.php so
> it shows the new value.
>
> AD

You'll need calculate.php to setcookie().  Then on the *next* index.php
invocation $_COOKIE['yourcookie'] should get updated with the value you
wrote to the cookie.

The only way to "refresh" calculate.php is to finish output to the
browser and then refresh index.php.  Although perhaps using a session is
better than using a cookie in this case?

I guess I don't grok your problem because the way you described it seems
trivial.

<?php

function calculate($var) { return "The value of var is $var"; }

/** From the browser / cookie / whatever */
$input = 11;
$output = calculate($input);
setcookie('yourcookie', $output);

/** And now you do whatever you want with output */
var_dump($output);

?>

--
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins

Attachment: signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux