PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
$_SESSION['lastpage'] = $_SESSION['thispage']; // 'lastpage' is now what 'thispage' used to be
$_SESSION['thispage'] = $_SERVER['PHP_SELF']; // update 'thispage'
This is a link of the site. When i click on a garment, it goes back to the main site. If i go and click on the jackets menu, and click the Return to catalog button, it goes to the main page. How do i update this link??
Actually I believe the link is updating. The problem i believe is the variables are not passing. I was under the impression that the variables would also get passed. If that is not the case, how would i get a link with the variables passed?
session_start() has been called. Im a bit confused?? Are cookies necessary for the urls to be tracked. Also the code which you have just posted, what does that do??
it's the HTTP response headers I got when going to the URL. If sessions were working, a cookie would be sent and/or most URL's on the page would be altered by php to include the session id.
Is error_reporting set to E_ALL? Try running the following (in a seperate script) and posting back the output:
okay, go into your php.ini, changing error_reporting to E_ALL, display_errors to On, and turning off register_globals.
After you restarting httpd and running your script, I'm going to guess you'll see something like "cannot modify headers: headers already sent." This problem can be solved by walking through this thread.
An undefined variable error usually indicates you are trying to use a variable that doesn't exist. So you'll want to test for those values using isset(). If the values are using incoming data you'll want to make sure the data is what you expect it be too.
yep. Will change that. On my test machine im getting these errors.
Warning: session_start(): Cannot send session cookie - headers already sent by (output started at C:\apache2triad\htdocs\treschic\catalog2\maintest.php:4) in C:\apache2triad\htdocs\treschic\catalog2\maintest.php on line 4 Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at C:\apache2triad\htdocs\treschic\catalog2\maintest.php:4) in C:\apache2triad\htdocs\treschic\catalog2\maintest.php on line 4 Warning: header() expects at least 1 parameter, 0 given in C:\apache2triad\htdocs\treschic\catalog2\maintest.php on line 16 Notice: Undefined index: thispage in C:\apache2triad\htdocs\treschic\catalog2\maintest.php on line 23 Notice: Undefined variable: paginate in C:\apache2triad\htdocs\treschic\catalog2\maintest.php on line 89
Besides the unidentified variables im getting these errors. Im doing some research on this at the moment. hopefully i can figure out where the problem lies. Feyd gave me a tutorial on this and im googling this as well.
basically, you it's saying you have an echo/html type output on line 4 of C:\apache2triad\htdocs\treschic\catalog2\maintest.php
a session cannot start if output has started. The tutorial I posted earlier will walk through the common solutions, basically, it involves holding off output of anything until after the session can start (at the least).
"Best practice" is leaving output to the very last thing the script does.