1. Home
  2. Computing & Technology
  3. Animation

Dynamic eCard with Flash and PHP

By Adrien-Luc Sanders, About.com

8 of 9

There’s not much else that you need to do in Flash, besides exporting an SWF of your eCard. Now you just need to create the web page that will load the SWF file for the eCard; make sure it has the same name and location as the URL that you entered in the getURL field, and make sure that its extension is .PHP and not .HTML or .HTM. You’re going to embed your SWF file into it, and then make a few interesting edits:
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width=550 height=400>
<param name=movie value="xmascard.swf?fromname=<?php echo $fromname; ?>&toname=&lt;?php echo $toname; ?>&mymessage=&lt;?php echo $mymessage; ?> ">
<param name=quality value=high>
<param name=bgcolor value=#FFFFFF>
<embed src="xmascard.swf?fromname=<?php echo $fromname; ?>&toname=&lt;?php echo $toname; ?>&mymessage=&lt;?php echo $mymessage; ?> " quality=high bgcolor=#FFFFFF width=550 height=400 type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">
</embed> </object>
Those bolded areas are where you would normally have just the file name – for example, ”xmascard.swf”. In this case, though, we see that we’ve appended several PHP variables, separated from the filename by a question mark (?) and appended together by an ampersand (&). Move on to the next step for an explanation of how this works.

Note: Do not copy my code directly. Due to restrictions on the About.com templates, at times certain symbols in my code are altered on display in certain browsers, and they will cause your code not to work. Instead type your own code, only using mine as guidelines.

Explore Animation
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. Animation
  4. Flash Animation Tutorials
  5. Dynamic eCard with Flash and PHP

©2009 About.com, a part of The New York Times Company.

All rights reserved.