Re: Error Message - Need help troubleshooting

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

 



On Tue, 2010-03-02 at 09:35 -0500, Rick Dwyer wrote:

> On Mar 2, 2010, at 8:48 AM, Ashley Sheridan wrote:
> >
> > How is $item_id created? You've not shown that in your PHP script  
> > examples.
> 
> // parse item id from the url
> $refer=$_SERVER['HTTP_REFERER'];
> $thispage=$_SERVER['PHP_SELF'];
> $item_id=substr($thispage, -9);
> $item_id=substr($item_id, 0, 5);
> 
> $_SESSION['item_id'] = "$item_id";	
> 
> The above is where item_id is created and added to a session.
> 
> The important thing is that this error never showed up before until I  
> added the Javascript link below:
> 
> var oss_itemid = "<?php echo $item_id; ?>";
> var loadOSS = window.open("http://www.myurl/myfile.php?iid="; +  
> oss_itemid, "",  
> "scrollbars 
> = 
> no 
> ,menubar 
> = 
> no 
> ,height=600,width=600,resizable=yes,toolbar=no,location=no,status=no");
> 
> 
> When I was testing initially, I had removed the variable above in the  
> link with a hard coded value and I never received this error.  Only  
> when I made it dynamic did this error appear.
> 
> Thanks for any help.
> 
> --Rick
> 

I'm assuming then that both the Javascript an the PHP code you have
above are both on the same page. The only way I can see your problem
occurring would be if your javascript part was on a different page and
you were attempting to output the $item_id. If PHP could not find a
variable with that name, it may be reverting to using the item_id value
found in $_SESSION, which would give you the error you're seeing.

Try changing the line to

var oss_itemid = "<?php echo $_SESSION['item_id']; ?>";

and see if that gives you the error.

Thanks,
Ash
http://www.ashleysheridan.co.uk



[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