How well does Flash & PHP mix?

I haven't worked much with forms yet in Flash. The existing
site that I'm replacing with a flash site uses some PHP to interact
with a MySQL database. It is for an email list that users can
sign-up for or remove themselves. I'm wondering if I will be able
to still (at least somewhat easily) do the same thing through
Flash. Here's the code currently used:
<?php
switch ($_GET['a']) {
case "s":subscribe();break;
case "r":remove();break;
default: subscribe();
function subscribe() {
require_once 'database.php';
require_once 'admin/lib.php';
$db = new Database('eaglebro_lists');
$show_form = true;
if ($_POST) {
if (is_email($_POST['email'])) {
$email = format_email($_POST['email']);
$uniqid = make_uniqid();
$db->query("REPLACE users (name, email, uniqid, created)
VALUES ('$_POST[name]','$email','$uniqid',NOW()) ");
$id = mysql_insert_id($db->db);
$db->query("REPLACE subscriptions (listid, userid,
created) VALUES ('11','$id',NOW()) ");
$show_form = false;
echo '<h3>Success!</h3><p>Thank you for
subscribing to the Route 212 email newsletter!</p><hr
/><p><a href="/">Route 212 Home
Page</a></p>';
} else {
echo "<h3>Error!</h3><p>The email address
you entered appears to be invalid. Check for any errors and submit
the form again.</p><hr />";
if ($show_form == true) {
?>
<p>Sign up to receive periodic email about Route 212
events and news.</p>
<form method="post"
action="/interact/updates.html?a=s">
<p>
<label class="m"
for="f_name">Name:</label><input id="f_name"
type="text" class="text m" name="name" />
<label class="m"
for="f_email">Email:</label><input id="f_email"
type="text" class="text m" name="email" />
<p><input id="f_submit" type="submit" class="button
s" value="Subscribe" /></p>
</form>
<?php
function remove() {
require_once 'database.php';
$db = new Database('eaglebro_lists');
//if email address is provided
if ($_GET['uid'] && $_GET['lid']) {
//perform database removal and show confirmation
$id = $db->query_fetch("SELECT id FROM users WHERE
uniqid='$_GET[uid]'");
$db->query("SELECT * FROM subscriptions WHERE
userid='$id[id]' AND listid='$_GET[lid]'");
if (mysql_num_rows($db->result)) {
$db->query("DELETE FROM subscriptions WHERE
userid='$id[id]' AND listid='$_GET[lid]'");
$list = $db->query_fetch("SELECT name FROM lists WHERE
id='$_GET[lid]'");
echo "<h4>Unsubscription
Successful</h4><p>You have been removed from the
following list: <b>$list[name]</b></p>";
echo '<hr /><p><a href="/">Route 212 Home
Page</a></p>';
} else {
$list = $db->query_fetch("SELECT name FROM lists WHERE
id='$_GET[lid]'");
echo "<h4>Cannot Unsubscribe</h4><p>You
have either already unsubscribed from the following list:
<b>$list[name]</b>, or an
error has occured.</p>";
echo '<hr /><p><a href="/">Route 212 Home
Page</a></p>';
} else {
echo "<h4>Cannot Unsubscribe</h4><p>There
is information missing.</p>";
echo '<hr /><p><a href="/">Route 212 Home
Page</a></p>';
?>

Josh,
I'm much more comfortable with PHP that Flash too. You won't
have a problem getting the two to work together. Its pretty easy
actually.
The key in my limited experience is to have your PHP to run
as normal and then communicate what you want to display to the user
via one of Flash's external data connection classes. There is a
great chapter on this in the book "flash 8 action script" by Adobe
--- the easiest way is to just use the "loadVars" class to accept a
string you've generated as output of your PHP file in the format:
&variable = data &variable = data etc...
Also here is a good site with an example I've found that was
helpful in getting the two languages to work together:
http://webmonkey.wired.com/webmonkey/03/40/index0a_page3.html?tw=programming
This example actually walks you through the communication
between all 3 --> MySQL, PHP and Flash.
Good luck!!
Tom

Similar Messages

  • How well does flash scale

    slightly offtopic:
    one of my friends thinks that flash will take over the internet in 5 years, with sites like this one: https://www.beatport.com/ <-- 100% flash.
    deeply in my soul i know he is wrong, but i need a better argument then that. ive never worked with flash, but i have a feeling that it might not use model/view/controller and that maintaining it might be more painful then a java webapp.
    do you guys have thoughts on this matter?

    I used to work with Flash, and I see it dying out. Frankly, it was screwed since Adobe bought it from Macromedia.
    It is much, much more difficult to connect to different languages/services/databases with Flash than it is with other languages.
    Connecting to a simple SQL database through PHP in Flash is a gigantic pain in the ass.
    Let's not forget that Flash Actionscript is dynamically typed. Heresy!

  • How well does Captivate work with Flash?

    I'm kind of new to e-learning. I can create interactivity in Flash  just have not used e-learning software, currently we have Articulate and  it seems to be limited to actionscript 2 and player 6 for some things I  need to do. Below is the description of what I have done.
    I created a module built in flash which has 4 questions (will have many more). The data and images are loaded in using an XML file. The questions require  the user to select the correct image, if he doesn't, he is asked to  push a button, to go back. When he selects the correct image he can move to the next question.
    I need the module to work in  a linear fashion, in articulate the user can move forward and back to any question as  he wishes because the navigation is on the articulate template and does  not control the swf.
    How well does flash communicate with captivate? Can I  pass variables? Can I restict the user from moving forward until a flash  "widget is complete"?
    Any help is appreciated!

    At the end of the day, the presentation is compiled into AS3 so you can easily communicated with Captivate. Actually, what you need to do is a Captivate Question Widget. If you build your swf as this, you'll be able to edit your questions from within Captivate and benefits from their LMS tracking features and some more.
    I'm pretty sure that you can block to move to the next question but maybe someone else can corroborate.
    HTH
    Whyves
    www.flash-factor.com

  • How well does windows work?

    How well does windows work on a Mac? I am thinking of getting a mac book pro and I would want to use the MAC OSX most of the time but sometimes on the road I will need to use windows for work. If I install windows also how well does it work?? Have you had any problems?

    Lots of questions! I'll do what I can, I am newish to Macs and not an IT expert.
    I use a MacBook when out and about, it seems fine, better when I upped the ram and HD. I'm not sure whether "better" is the right term. The pro's bigger screen and keyboard may be useful - your choice. The MacBook is my choice because of weight and price, I'm not sure what to get next time. I think I prefer portability for travel and Mac Pro power for deskbased work. The graphics driver would be the deciding factor for Cad etc for me. Not an issue so far and it's a 2 year old MacBook.
    I did put a new hard drive in, the partitions were too small. A 250gb drib=ve is MUCH cheaper than a new machine, simple to install. I allowed the max XP partition at 30gb (FAT).
    AV - antivirus software for XP - essential to keep clean files.
    Leopard - run BootCamp and follow the instructions. It will tell you when to insert the XP disk etc. Mine was choosy about the XP version, you need a recent one. Early SP1 just don't work.
    I prefer to use BootCamp and not Fusion etc - simply to maximise the MacBook resources - it's not sharing anything. That may be why I can run the apps. You just need a little planning on what you are going to work on.
    Think that's all , as I said, I'm just a user.

  • How well does the wireless "Wild Charge" pad work with the iPhone?

    how well does the wireless "Wild Charge" pad work with the iPhone?

    I have tried similar things, and no, it has not become corrupted. So it should be fine

  • How well does the TomTom app work?

    Let's hear it, how well does the TomTom app work compared to a dedicated GPS device? Are you using TomTom's special cat kit? Is there a way to load TomTom binary files (POIs) onto the iphone?

    I have used a Garmin Nuvi760 for about 2 years and have been very pleased. When TomTom had a sale for $50 and now seems to be $60, I bought it. I also bought a kensington car mount. (http://us.kensington.com/html/17546.html). I like it. with my 3GS, there is no need for the amplified TomTom car kit. The speech quality could be better but it's loud enough. I do like the on screen presentations a bit more than my Garmin. I'm still getting used to the interface. It's a real good thing that I can use my contacts file to set destinations. My next step is to go on an 800 mile trip this month and compare the two systems side by side. So far, TomTom has not always made the best route choice and once sent me to the right address in an adjoining city. (This is southern Cal) Not good, but these are map issues which will always be evolving. Is it worth it? Yes. At $100, maybe. The good thing is that my phone is always with me and so is my GPS. I does put a drain on the battery, so it should be on charging while using in a car.

  • How well does the express work in a 2400 square foot home being on the top floor? us on the bottom floor

    How well does the express work in a 2400 square foot home being on the top floor? us on the bottom floor

    How well does the express work in a 2400 square foot home being on the top floor? us on the bottom floor
    As you might imagine, without knowing a ton of information about the actual construction of the walls and ceiling of your home.....how many walls and other obstructions would be in the signal path of each device.....and the distance between each device and the AirPort Express.....along with how many users would be online at one time or another and what activities they would be involved in......etc., it's really not possible to accurately predict what type of results you might achieve.
    The bottom line with any wireless installation is that you really won't know how effectively it will actually perform until you try it.
    My opinion would be that you will likely need to add an additonal AirPort Express to "extend" the wireless more effectively to the bottom floor. But again, the same things apply as above.

  • How well does the iPhone 5s/5c work with Wind Mobile?

    I'm going to be (hopefully) getting the iphone 5s or 5c soon and I'm trying to decide on which carrier to go with. How well does the iphone 5s/5c work with wind mobile and how fast is the internet with data?

    http://www.windmobile.ca/
    iPhone: Wireless carrier support and features

  • How well does the Droid Charge do when dropped accidentally?

    how well does the Droid Charge do when dropped accidentally? any screen or internal damages?
    I'm probably going to have some kind of rubberized case.

    Please consider getting an otterbox commuter case at least from amazon or otterbox.com
    the defender series otterbox case with screen protector case isn't being shipped yet so i am using
    the otterbox commuter case with verizon wireless store's 3pack of screen protectors - i do not like screen protectors but verizon sells the ones for the charge specifcally and it will
    hold me over just fine until defender ships in august or september
    either case helps to not accidentally press the power button easily while holding this droid Charge
    there's my advce
    ps these add bulk to phone i like the commuter case it is way sturdy polycarbonate or whatever STRONG black plastic with port covers except for hdmi that already has a cover built into phone
    the defender series will be bulkier

  • How well does keynote convert MS office powerpoint files?

    How well does keynote convert MS office powerpoint files? A colleague prepares Powepoinr presentations and if they send them to me will I be able to edit the content and send it back to them?

    There are numerous threads about this question, you might profit from looking at some of them.
    Preategui, KN does open PP docs, unless something's wrong. If you could describe, as exactly as possible, what you do, and what happens, we can probably sort this out.
    That said, back to the OP: converting from PP to KN or vice-versa is easy enough, but they don't always translate exactly - remember, they're different programs, differently written, with different capabilities. The simpler the presentation, the fewer the differences will be; the more bells and whistles (animations, transitions), the differences become greater. Be aware that fonts often cause problems: the standard Mac font set is not identical to the standard Windows font set, and some people might be using custom fonts. About the only way to be sure your Windows recipient will see a KN presentation exactly as it was constructed is if it's exported to QT, but that wouldn't suit your purpose at all.
    If the editing you want to do is limited to text and other content, you shouldn't have too much of a problem. But I'd stay away from changing formatting, animations and transitions.

  • How well does Final Cut Pro X run on an off-the-shelf 21.5" iMac?

    I'm looking at purchasing an iMac for video editing projects but my budget is very limited. How well does a plain-jane iMac 21.5" (SATA 5400 RPM Drive, Iris Pro Graphics, 8 GB RAM) run FCPX?
    Currently at my office I'm running FCPX on a Mid-2010 model with the 3.06 Core i3, 4GB of RAM and a Radeon HD 4670 256 MB. It is more than adequate for my needs in both FCPX and Motion 5. Will the current base model compare favorably to the one I'm already using?

    Ian R. Brown wrote:
    Most of the drives in MacBookPros were only 5,400rpm and I don't recollect them causing any problems with editing.
    Yup, depends on simplicity and what you can "get away with".
    Al

  • How well does a Macbook pro and a Macbook air run Xcode, Photoshop and Dreamweaver?

    How well does a Macbook pro and a Macbook air run Xcode, Photoshop and Dreamweaver?

    MacBook Pro - no problem, it is an extremely popular computer for running that software. Just look at the Adobe demo videos of their products, most of the time you can see a MacBook Pro running the software in their video.
    MacBook Air - should be just as good most of the time.
    However, if you get involved in heavy Photoshop work like highly stacked layers/masks/channels, 16 bits per channel or up, or merging HDR or panoramas, the MacBook Pro may be better because it can take 16GB RAM while the MacBook Air can take only 8GB RAM.
    Also, if you are going to do serious programming in XCode or Dreamweaver, you may find the MacBook Air screen to be too small for all of the code windows and tool palettes that you may want to open and arrange in those programs. The 15" Retina screen of the MacBook Pro will let you spread out your work and do less window switching. The 11/"13" MacBook Air screens are both smaller and non-Retina so not as sharp.
    Even Photoshop is nicer on the 15" MacBook Pro because of the extra screen space for the image with less intrusion by the tool palettes.
    In short, if you are a casual user the MacBook Air will be great. If you are a professional with a heavy workload the MacBook Pro may be more efficient overall due to the larger screen and higher RAM capacity.

  • How well does Qmaster via Compressor work with FCP 7?

    How well does Qmaster via Compressor work with FCP 7?

    It works wonderfully as long as you are running (at least) OSX 10.5.6 + QT 7.6 on a serious intel mac.
    x

  • How well does office for mac 2011 run on yosemite?

    How well does MS office for mac 2011 run on Yosemite?

    MacBook Pro late-2011, running Yosemite Beta 6. MS Office works just fine. No glitch whatsoever.
    Cheers,
    JP

  • Was wondering how well does the 1Ghz titanium runs Leopard?

    Hi
    Could some one put up a youtube video of how well leopard runs on the last titanium g4?
    I mean the minimum for leopard is 800mhz ... but how well does it actually run? is it worth purchasing leopard if you have 1Ghz?
    Thanks
    Chris

    Hi, Nomad.c. How fast any OS runs on any computer is a lot more than you could reasonably expect to learn from any YouTube video.
    We've seen posts here from people who had installed Leopard even on Tibooks that didn't meet the minimum processor-speed requirement of 867MHz (not 800MHz). They seemed to be happy with it by and large, but they may have had reasonable expectations going in. It won't be faster than what you're running now, but it will have some new features; you may or may not find them valuable. But you'd better have your Tibook's RAM maxed out at 1GB, because Leopard is much greedier for RAM than Tiger or Panther. That means if you use RAM-hungry applications on top of Leopard, you're going to make greater use of virtual memory than you have up to now, and VM is many times slower than real RAM.

Maybe you are looking for

  • Will my mid 2010 macbook pro mirror on my apple tv?

    I upgraged to mac osx mountain lion and i cannot seem to use the mirroring image on my apple tv!!

  • How do you import music from your ipod to your itunes???

    I just got a new computer and I can't figure out how to get my music from my ipod to my new itunes, does anyone know how?

  • No XML generated

    Hello experts, I have problem with generation of XML stack file for ERP Enhancement Package 4. I get warning message "No XML generated" in Maintenance Optimizer on the step 2.2 (Select OS/DB-Dependent Files) I get this message for Enhancement Package

  • IBD  BASED INVOICE THROUGH EDI

    DEAR EXPERTS, I'M HAVING A SCENARIO WHEREIN MY CLIENT IS IMPORTING SOME GOODS AND THE GOODS ARE VERIFIED AT VENDOR'S SITE BY ONE OF OUR CLIENT'S PERSON AND THE PERSON CREATES A INBOUND DELIVERY IN SAP AND THEN THE GOODS ARE SHIPPED. BASED ON THE IBD

  • PD 16.5 SP03 PL03 slowness after reverse engineering

    Little background: We were using PD 16.5 SP03 PL01 and faced a lot of problems like error messages, exception error, slowness etc. I was recommended on this forum to apply patch PL03 to solve the problems. I have applied the patch PL03. Current Probl