Flash
  Home arrow Flash arrow Page 2 - Building Web Forms In Flash
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
VPS Hosting  
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid  
Request Media Kit
Contact Us  
Site Map  
Privacy Policy  
Support  
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
FLASH

Building Web Forms In Flash
By: icarus, (c) Melonfire
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 310
    2002-08-07


    Table of Contents:
  • Building Web Forms In Flash
  • Access Granted
  • Alien Invasion
  • Loading Up
  • Coming Back For More
  • A Fine Balance

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article

     
     
    ADVERTISEMENT


    Building Web Forms In Flash - Access Granted
    ( Page 2 of 6 )

    Obviously, that was a very primitive example, though one that did demonstrate the concept of integrating user-supplied data with a server-side script via a Flash movie. Now, how about a twist?

    This next example uses the data entered into a Flash form to query a database and return a list of matches. In order to create the form, create a new Button symbol, in much the same way as you created the one on the previous page. Name the form variable within the symbol "q", and add a copy of the instance to the Flash movie.



    Once that's done, add some ActionScript to the symbol instance, referencing the server-side script "search.php" - this time, use POST to send the form variables to the script.

    on (keyPress "<Enter>") { getURL ("search.php", "", "POST"); }
    All that's left now is to write the PHP script "search.php". Here's what mine looks like:

    <html> <head><basefont face="Arial"></head> <body> <h2>Search Results</h2> <ol> <? // search.php // get query term $query = trim($_POST['q']); // open connection to database $connection = mysql_connect("localhost", "user", "pass") or die ("Unable to connect!"); mysql_select_db("db20139a") or die ("Unable to select database!"); // formulate and execute query $query = "SELECT * FROM data WHERE tag LIKE '%$query%' OR keyword LIKE '%$query%'"; $result = mysql_query($query) or die("Error in query: " . mysql_error()); // get record while($row = mysql_fetch_object($result)) { echo "<li>"; echo "<a href=go.php?id=$row->id>$row->tag</a>"; echo "<br>$row->title"; echo "<p>"; } // clean up mysql_close($connection); ?> </ol> </body> </html>
    Here's what the search box looks like,



    and here's a sample results page.



     
     
    >>> More Flash Articles          >>> More By icarus, (c) Melonfire
     

       

    FLASH ARTICLES

    - An Overview of Flash and ActionScript
    - Building Web Forms In Flash
    - Building Data-Driven Flash Movies
    - Flash 101 (part 6): The Final Countdown
    - Flash 101 (part 5): Spiralling Out Of Control
    - Flash 101 (Part 4): Don't Touch Me!
    - Flash 101 (part 3): Bouncing Around





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 2 Hosted by Hostway
    Stay green...Green IT