Click to See Complete Forum and Search --> : encode variable behind url
I have the following code that work fine,
on (release) {
cardno = 1234;
random2 = Math.ceil(Math.random()*1000000);
loadVariablesNum("view.php?reload="+random2, 0, "POST");
gotoAndPlay(3);
}
but what if i wanan encode the "cardno" var behind an url, somthing like
http://www.demo.com/view.htm?cardno=1234
it doesn't work anymore. Any idea?
chup
Musicman
05-29-2002, 06:18 PM
Hi,
I am not sure whether I understand you...
Server scripts (php, cgi, asp) understand variables in the url unless you decide otherwise, and swf files understand them.
Html files do not understand vars, unless you add some javascript that picks them up
Musicman
hi,
so if i save my view.htm into view.php, will it work?
in my case, view.php will be just a simple html file without any php script but save in php format. the php script that that will load infromation from the database will be call from the swf itself. Is this the correct flow?
chup
Abelius
05-30-2002, 01:05 AM
Could it be that cardno is handled as a number instead of as a string?
Mybe using the cardno = cardno.toString(); would work...
I think i will explain my problem in more detail..
i have 3 file now
card.swf ---> swf file with script to call viewcard.php
card.php ---> the html file that contain card.swf but save in php format
viewcard.php ---> the php script that does all the job.
it work okie if this following script is in the 1st frame of card.swf
viewID = 8230; //dummy id number for testing
cardno = viewID ;
cardno = cardno.toString();
random2 = Math.ceil(Math.random()*1000000);
// Loads the Variables
loadVariablesNum("viewcard.php?reload="+random2, 0, "POST");
play();
but now, i wanna the viewID to be encode behind the card.php, some like www.demo.com/card.php?viewID=8230
with this following code on the swf only
cardno = viewID ;
cardno = cardno.toString();
random2 = Math.ceil(Math.random()*1000000);
// Loads the Variables
loadVariablesNum("viewcard.php?reload="+random2, 0, "POST");
play();
but it not working at all..
where is the mistake?
chup
Musicman
05-30-2002, 04:26 AM
Hi,
do I understand you right: you want to pass the number to card.php, and card.php should pass it on to card.swf, so that card.swf knows how to call the viewcard.php ?
Inside card.php, add these changes
<object...> <param name=movie value="card.swf?cardID=<?=$cardID?>"> .... <embed src="card.swf?cardID=<?=$cardID?>" ....>
Card.swf will then have the cardID variable defined without further action.
Using both POST and explicit vars is somewhat useless; if you add vars to the query string anyway, you should perhaps
loadvariablesNum('viewcard.php?reload='+random2+'&cardID='+cardID, 0)
Musicman
yeah, thanks!
problem sloved..:)
chup
[Edited by chup on 05-30-2002 at 07:10 AM]
flashkit.com
Copyright WebMediaBrands Inc., All Rights Reserved.