Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #5747
| From | Scott Johnson <noonehome@chalupasworld.com> |
|---|---|
| Newsgroups | comp.lang.php |
| Subject | Re: Session variables.. |
| Date | 2012-04-26 05:36 -0700 |
| Organization | A noiseless patient Spider |
| Message-ID | <jnbfgl$e4i$1@dont-email.me> (permalink) |
| References | <22074986.120.1335432844876.JavaMail.geo-discussion-forums@pbgg7> |
On 4/26/2012 2:34 AM, xs2karan3190@gmail.com wrote: > I know there is some problem regarding session variables but I am not able to get what it is.. Kindly help. > my code is in 2 files... > > > test0.php---> > > <html> > <body> > <?php > > session_start(); > $_SESSION['id']="1"; > $_SESSION['psid']="admin"; > > echo $_SESSION['id']." ".$_SESSION['psid']; > > ?> > <form method="get" action="test1.php"> > <div id="id" name="name">Hello mr.</div> > > <input type="submit" name="click" /> > </form> > </body> > </html> > > > > test1.php---> > > <html> > <body> > <?php > session_start(); > echo $_SESSION['id']." ".$_SESSION['psid']; > $a=$_GET['id']; > echo $a; > ?> > <br/> > <a href=test0.php">Back</a> > </body> > </html> > -------------------------------------------------------------------------------- > > At start I open the test0.php on my localhost and click on submit button,test1.php loads perfectly.But when I click on back buton in test1.php the url is "localhost\test0.php%22"... > and error msg is access forbidden.. > where does this extra %22 come.??? > > PLZ HELP.. Make sure that: 1. Your <?php tag is the first entry on the file(page), not even a blank line or space, or a header will be created and sent to the server prior to session_start is called and will barf. 2. Make sure that session_start in the <?php tags is called before any out put such as echo, print, header etc.... 3. Sometimes it is good when debugging $_SESSION to check the entire contents to ensure that what you want is not getting overwritten by a current script. Use var_export($_SESSION). or $session = var_export($_SESSION, true); and then read out $session elsewhere if needed such as a mail() call if you are testing a script not meant for display.
Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Session variables.. xs2karan3190@gmail.com - 2012-04-26 02:34 -0700
Re: Session variables.. "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-04-26 11:39 +0200
Re: Session variables.. karan kumar <xs2karan3190@gmail.com> - 2012-04-26 23:33 -0700
Re: Session variables.. "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-04-27 10:59 +0200
Re: Session variables.. Jerry Stuckle <jstucklex@attglobal.net> - 2012-04-27 06:30 -0400
Re: Session variables.. karan kumar <xs2karan3190@gmail.com> - 2012-05-02 21:19 -0700
Re: Session variables.. Jerry Stuckle <jstucklex@attglobal.net> - 2012-05-03 08:11 -0400
Re: Session variables.. karan kumar <xs2karan3190@gmail.com> - 2012-05-03 23:19 -0700
Re: Session variables.. Jerry Stuckle <jstucklex@attglobal.net> - 2012-05-04 07:36 -0400
Re: Session variables.. karan kumar <xs2karan3190@gmail.com> - 2012-04-26 23:36 -0700
Re: Session variables.. "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-04-27 10:52 +0200
Re: Session variables.. "Olaf S." <thesys@gmx.de> - 2012-04-26 14:10 +0200
Re: Session variables.. "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-04-26 15:12 +0200
Re: Session variables.. Jerry Stuckle <jstucklex@attglobal.net> - 2012-04-26 20:35 -0400
Re: Session variables.. Scott Johnson <noonehome@chalupasworld.com> - 2012-04-26 05:36 -0700
Re: Session variables.. Jerry Stuckle <jstucklex@attglobal.net> - 2012-04-26 20:37 -0400
csiph-web