Click to See Complete Forum and Search --> : cookies again


Anne Vance
10-15-2003, 08:09 AM
Hello,
Again I need some help.

On one page with photos I have the script:

<script language="JavaScript" type="text/javascript">
<!--
document.write("bestelde foto @ " + document.location);
// -->
</script>

this produces:
bestelde foto @ http://www.blablabla.be/photo_album/./gal_1/006_01.jpg which is correct and what I want.

Now I make a cookie:

<script type="text/javascript">
<!--
function write_cookie()
{
var verval =1000*60*60*24;
var nu = new Date();
var vervaltijd = new Date(nu.getTime() +
verval);
vervaltijd = vervaltijd.toGMTString() ;
document.cookie ="bestelling="+ document.location +
"; expires=" + vervaltijd + ";" ;
}
// -->
</script>

And on the form (next page) where I read the cookie

<input type="text" size=70 value="<?php echo $_COOKIE['bestelling']; ?>" name="bestelling">

Iget the result:

http://www.blablabla.be/photo_album/?gal=1&pic=1

So the cookie reads the location in the list of photos and not the url where the name of the jpg is shown.

How come and how can I fix this. ?

pyro
10-15-2003, 08:15 AM
Originally posted by Anne Vance
<script language="JavaScript" type="text/javascript">
<!--
document.write("bestelde foto @ " + document.location);
// -->
</script>

this produces:
bestelde foto @ http://www.blablabla.be/photo_album/./gal_1/006_01.jpg which is correct and what I want.I don't think so. If your page has a .jpg extention, then you won't be able to have any JavaScript on it. So, it will have to be returning a page, rather than an image...

Anne Vance
10-15-2003, 08:25 AM
What it shows is the url of the picture which is shown at that moment. when you click for the next picture the url changes correcly.

I want this url filled into a form and thought cookies would be the way to do this.

true or false?

pyro
10-15-2003, 08:28 AM
I'm not understanding what you are looking for. Do you have a link?

Anne Vance
10-15-2003, 08:40 AM
Don't look at the garbage it's a test

www.jachtindex.be

click on test 1
you will see picture 1 of gallery 1
at the bottom there is the actual name/location of the picture shown. when you move to the picture it dissapeaers and when you click you go to a order form where the shown picture can be ordered.
Since the photolist changes over time I need the exact name of the picture and cannot risk people typing it out.

Hope it's clear pyro

Anne Vance
10-15-2003, 10:23 AM
Oops , all wrong.
I had a piece of code behind my script that shouldn't be there.
I'll sort this out first.
thanks anyway