PDA

View Full Version : Passing Variables between HTML pages


ifonly
07-24-2003, 09:47 AM
i have been trying to use the very helpful tutorial on passing a variable between html pages:

http://www.actionscripts.org/tutorials/intermediate/passing_variables_around/index.shtml

it passes a value $value between two pages using a holding php script- nice.

what i need it to do is pass a number of variables

here is an attempt to adapt the script:

<title>Passing Value <?php echo $make, $description; ?></title>
<body bgcolor="#FFFFFF" text="#000000">
<table width="100%" border="0" height="100%">
<tr>
<td align="center" valign="middle">
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">This is just
the middle page where you can do whatever...<br>
The value you passed by the way was <b>
<?php echo $make; ?>
<?php echo $description; ?>
<?php echo $mainuser; ?>
<?php echo $signedout; ?>
<?php echo $outdate; ?>
<?php echo $signedin; ?>
<?php echo $supplier; ?>
<?php echo $hire; ?>
<?php echo $contractor; ?>
<?php echo $notes; ?>
<?php echo $service; ?>
</b></font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">You can now
click <a href="end.php?make=<?php echo $make; ?>">here</a> to end your variable back to<br>
another HTML-based page with a Flash file in it.</font></p>
</td>
</tr>
</table>

I have added description to variables echo at the start but it doesn't list it when view the page, (it only lists description wierdly)

what am i doing wrong?

do i need to add it to the button at the bottom to work? surely it should print it out anyway ( I know i will have to adjust the click here button script too any help on the syntax of that would be greatly appreciated...i assume it will be similar to the top bit tho)

thanks

marcus

fgf
07-24-2003, 10:07 AM
what exactly are you trying to do?

The simplest way to pass variables between html pages would be shared objects.

The approach in the tute has its uses but if you don't need to do it that way its a bit of a faf.

If you just want user preferences ior name or whateverto persist over the course of viewing a site on multiple html page use shared objects.

fgf

ifonly
07-24-2003, 10:13 AM
I need to send some variables from one movie to another.
What happens is a php script queries a database and returns variables to a table in a flash movie.
I want an edit button to link to a new flash movie where the user can edit the data and save it.

My problem: when i click the edit button in the first movie

button AS code:

on (release) {
loadMovieNum("update.html", 0, "POST");
}

The variables are not appearing in my update.swf
I have tried using 'send using GET' but that doesn't work either.
Curiously the POST method prints the variables in the location bar as well as the GET method, when previously this would only occur if I used GET.

The variables appear in the dynamic text boxes of the original movie but the same boxes in the update movie are blank!

How do you implement your method?

thanks in advance for any help

marcus

fgf
07-24-2003, 10:15 AM
when u run the scripts separately from flash (i.e. send in data with a form on and html page) do they respond correctly?

Also what code are u using to grab from a DB? The tutorial only passes variables using the url (get method).

Does your movie need persistant data on the server rather than on a users machine? Does it need persistant (i.e still there when the user leaves then reenters the site ) at all?

fgf

ifonly
07-24-2003, 10:21 AM
I am not sure if understand your question.

The data in the first flash movie arrives, but when you press the button to take you to the updating page (a swf embedded in new html page) the variables are not passed to it. i need a method of passing the variables between the two html pages or maybe loading the updater page into my original html holder and using shared object may avoid all this passing from one html to another?

i hope this makes it clearer

if not repeat your question in words of one syllable and i will really try this time! :D

marcus

fgf
07-24-2003, 10:26 AM
I've edited my last post to get some more info.

What i was talking about was test the data going back and forward with bog standard html makes it easier to see if the php is performing correctly.

You do realise that the flash movie in the tut example gets its variables from the path to the swf in the object and embed tags and you have to write that path dynamically in the final page php script? If I understand u at all that sounds like where the problem is. Does your final page get the query string (?blah=blah) data in the url?

But as i said if you don't need the data to be on the server just use SO.

fgf

ifonly
07-24-2003, 10:46 AM
Also what code are u using to grab from a DB?
php script that queries the db

Does your final page get the query string (?blah=blah) data in the url?
yeah i get:

http://smoothriders.com/UKSSchedule/garage/update.html?FUIComponentClass=%5Btype+Function%5D&FRadioButtonClass=%5Btype+Function%5D&FRadioButtonGroupClass=%5Btype+Function%5D&description=ohoh&search=description&n=1&make0=bob&description0=ohoh&service0=2003%2D01%2D01&mainuser0=iuiu&signedout0=kk&hire0=ff&signedin0=hh&supplier0=gg&contractor0=dd&no0=sss&outdate0=2003%2D01%2D01&plantnumber0=44&%0A%09%09=&pauseDuration=2000&framesInLoop=4&startTime=null&lapsedTime=2239

should the update html be renamed update php?

why is it sending lots of other variables like:
FUIComponentClass=%5Btype+Function%5D

and ignoring the variables i want like:
&make0=bob&description0=ohoh

any help much appreciated

marcus

fgf
07-24-2003, 11:24 AM
flash sends all variable on the same time line as whatever actionscript gets or post them. even stuff that has nothing to do with what you want sent. Use loadVars to send only the data you want.

update.html should be update.php if there is any php script in it.

what i get when i look at the page source for update.html suggests no attempt has been made to pass any variables into the flash movie.

Why can't you use a loadVariables or loadVars action from inside the movie in update.html to load previous data from the db? The query string thing in that tut is only really for cases where you aren't using a db.

Also i get the impression you are moving to different html pages when you could just stay in the flash movie. That data entered succesfully popup would be far better keep inside flash (or at least the same html window)

fgf