Hello,
>
> The cookie from the file below seems to work fine if all of our code
> files are on a one machine. But if it is moved to the server and the
> webpage is accessed from a client machine, the cookie is not being
> set.
>
> Below is the code, could anyone please give some more information about Cookie behaviour,
> as it is very confusing for us (still learning PHP).
>
> The variable $i is declared as a global variable, as this file gets
> the value for $i from another php file, which passes the value through
> query string.
>
> We need this cookie value in another application.
>
> Thank you,
> Shal
>
> <?php
> // Connection String
> define('DB_NAME','sample');
> @ $dbc = mysql_connect("localhost", "myname", "mypassword"
;
> mysql_select_db(DB_NAME);
> import_request_variables('gpc', 'r_'); $i = &$r_idsearch;
> error_reporting(E_ERROR) ;
> setcookie("testcookie", $i, time()+3600); echo $_COOKIE["testcookie"];
> include 'css1.html'; echo '<p align="center"><b><u><font size="2"
> color="blue"> Click on the form to open</font></u></b></p>'; echo
> '<b><a href="C:\Inetpub\ Forms -
> report</a></b><br> <b><a
> href="C:\Inetpub\ Form -
> Report</a><b><br />'; ?>
>
> The cookie from the file below seems to work fine if all of our code
> files are on a one machine. But if it is moved to the server and the
> webpage is accessed from a client machine, the cookie is not being
> set.
>
> Below is the code, could anyone please give some more information about Cookie behaviour,
> as it is very confusing for us (still learning PHP).
>
> The variable $i is declared as a global variable, as this file gets
> the value for $i from another php file, which passes the value through
> query string.
>
> We need this cookie value in another application.
>
> Thank you,
> Shal
>
> <?php
> // Connection String
> define('DB_NAME','sample');
> @ $dbc = mysql_connect("localhost", "myname", "mypassword"
> mysql_select_db(DB_NAME);
> import_request_variables('gpc', 'r_'); $i = &$r_idsearch;
> error_reporting(E_ERROR) ;
> setcookie("testcookie", $i, time()+3600); echo $_COOKIE["testcookie"];
> include 'css1.html'; echo '<p align="center"><b><u><font size="2"
> color="blue"> Click on the form to open</font></u></b></p>'; echo
> '<b><a href="C:\Inetpub\ Forms -
> report</a></b><br> <b><a
> href="C:\Inetpub\ Form -
> Report</a><b><br />'; ?>