Re: refreshing an included php file
| From: | Jason Barnett | Date: | Mon, 21 Mar 2005 23:45:16 +0000 |
| Subject: | Re: refreshing an included php file | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-211223@lists.php.net to get a copy of this message | ||
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: [application/pgp-signature] OpenPGP digital signature signature.asc
Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc