Results 1 to 2 of 2

Thread: php in Flash

  1. #1

    Question php in Flash

    Ok quick question.....

    right trying to create a datebase collection thingy in flash - all its gotta do is people enter their names, mobile & email and it writes it to a txt file - now have gotten the coding done for the flash part - i think!? basically on the submit button actions i have :

    Code:
    on (release) {
    	if (Name eq "") {
    		_root.Status = "Please enter your name";
    	} else if (Mobile eq "") {
    		_root.Status = "Please enter your Mobile Number";
    	} else if (Length(Mobile)  < 11) {
    		_root.Status = "Please enter a valid Mobile number";
    	} else if (Email eq "") {
    		_root.Status = "Please enter you Email Address";
    	} else {
    		Submit = "Yes";
    		NumHigh = 10;
    		NumLow = 0;
    		loadVariablesNum ("database.php", 0, "POST");
    		_root.Status = "";
    		gotoAndStop (2);
    	}
    }
    ok as you can prolly see the code just checks that they have filled all fields then takes them to next frame - now writing to the php file i aint to sure about as have never tried using php before what i have come up with is.....

    Code:
    <?php
    
    $Submit 	= $_POST["Submit"];
    $Name 		= $_POST["Name"];
    $Email 		= $_POST["Email"];
    $Mobile 	= $_POST["Mobile"];
    $NumLow 	= $_REQUEST["NumLow"];
    $NumHigh 	= $_REQUEST["NumHigh"];
    
    $Name 		= ereg_replace("[^A-Za-z0-9 ]", "", $Name);
    $Email 		= ereg_replace("[^A-Za-z0-9 \@\.\-\/\']", "", $Email);
    $Mobile         = ereg_replace("[^0-9 ]", "", $Mobile);
    
    $Name 		= stripslashes($Name);
    $Email 		= stripslashes($Email);
    $Email 		= stripslashes($Mobile);
    
    // ###################################################################################
    // ########## Reading and Writing the new data to the GuestBook Database #############
    
    if ($Submit == "Yes") {
    
    	$filename 	= "database.txt";
    
    
    	$fp 		= fopen( $filename,"r"); 
    	$OldData 	= fread($fp, 80000); 
    	fclose( $fp ); 
    
    	$New = "$Input$OldData";
    
    
    	$fp = fopen( $filename,"w"); 
    	if(!$fp) die("&database=cannot write $filename ......&");
    	fwrite($fp, $New, 800000); 
    	fclose( $fp ); 
    }
    
    
    ?>

    right hopefully you get what i mean??? i have the permissions set to 777 on the guestbook.txt so it should be ok to write to!?
    well any help you guys can provide will be much appriciated

    v_Ln

  2. #2
    ---------------------------------------------------------------------------------------------------------------
    http://www.flashkit.com/tutorials/Dy...-705/more2.php
    http://ultimosoft.nullcreations.net/...pguestbook.php
    http://www.flash-db.com/GuestBookTut/
    ---------------------------------------------------------------------------------------------------------------

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •