Форум: Форум PHPФорум ApacheФорум Регулярные ВыраженияФорум MySQLHTML+CSS+JavaScriptФорум FlashРазное
Новые темы: 0000000
PHP Puzzles. Авторы: Кузнецов М.В., Симдянов И.В. Самоучитель PHP 5 / 6 (3 издание). Авторы: Кузнецов М.В., Симдянов И.В. PHP на примерах (2 издание). Авторы: Кузнецов М.В., Симдянов И.В. MySQL 5. В подлиннике. Авторы: Кузнецов М.В., Симдянов И.В. C++. Мастер-класс в задачах и примерах. Авторы: Кузнецов М.В., Симдянов И.В.
ВСЕ НАШИ КНИГИ
Консультационный центр SoftTime

Форум PHP

Выбрать другой форум

 

Здравствуйте, Посетитель!

вид форума:
Линейный форум Структурный форум

тема: Куда деваются переменные из flash формы?
 
 автор: D.A.N_visator   (05.01.2007 в 01:51)   письмо автору
 
 

Куда деваются переменные из flash формы?
в php обработчик попадают пустые значения!

   
 
 автор: DEM   (05.01.2007 в 02:27)   письмо автору
 
   для: D.A.N_visator   (05.01.2007 в 01:51)
 

Приведите код пожалуйста...

   
 
 автор: D.A.N_visator   (05.01.2007 в 12:40)   письмо автору
 
   для: DEM   (05.01.2007 в 02:27)
 

2 scripta + cartinca
Spasibo!


1


//****************************************************************************
//Copyright (C) 2005 Macromedia, Inc. All Rights Reserved.
//The following is Sample Code and is subject to all restrictions on
//such code as contained in the End User License Agreement accompanying
//this product.
//****************************************************************************

/* 
PHP and Flash example
This example shows you how to create a guestbook using Flash and PHP integration.
*/

stop();

// import the required component classes.
import mx.controls.*;

// define the component instances on the Stage.
var name_ti:TextInput;
var email_ti:TextInput;
var url_ti:TextInput;
var comments_ta:TextArea;
var clear_button:Button;
var submit_button:Button;
var name_label:Label;
var email_label:Label;
var url_label:Label;
var comments_label:Label;

//set color of labels
name_label.setStyle("color", "0xFFFFFF");
email_label.setStyle("color", "0xFFFFFF");
url_label.setStyle("color", "0xFFFFFF");
comments_label.setStyle("color", "0xFFFFFF");

// set the tabbing order for the components
this.name_ti.tabIndex = 1;
this.email_ti.tabIndex = 2;
this.url_ti.tabIndex = 3;
this.comments_ta.tabIndex = 4;
this.clear_button.tabIndex = 5;
this.submit_button.tabIndex = 6;

// set the default form focus to the name_ti TextInput instance, and set the default button to the submit button.
Selection.setFocus(name_ti);
focusManager.defaultPushButton = submit_button;

// when the post_mc or view_mc movie clip's are clicked and released, goto the appropriate named frame label.
post_mc.onRelease = function() {
    this._parent.gotoAndStop("post");
};
view_mc.onRelease = function() {
    this._parent.gotoAndStop("view");
};

// when the clear button is clicked, set the form fields to empty strings.
var clearBtnListener:Object = new Object();
clearBtnListener.click = function(evt:Object) {
    name_ti.text = "";
    email_ti.text = "";
    url_ti.text = "";
    comments_ta.text = "";
};
this.clear_button.addEventListener("click", clearBtnListener);

// when the submit button is clicked, send the form values to the server using a LoadVars object.
var postBtnListener:Object = new Object();
postBtnListener.click = function(evt:Object) {
    // if the name is blank, display an error message using the Alert component.
    if (name_ti.text.length == 0) {
        Selection.setFocus(name_ti);
        Alert.show("Please enter your Name.", "Error", Alert.OK);
        return false;
    }
    // make sure the user has filled in either the email_ti or url_ti TextInput instances.
    if ((email_ti.text.length == 0) && (url_ti.text.length == 0)) {
        Selection.setFocus(email_ti);
        Alert.show("Please enter your Email Address or URL.", "Error", Alert.OK);
        return false;
    }
    // make sure the comments_ta TextArea instance isn't blank.
    if (comments_ta.text.length == 0) {
        Selection.setFocus(comments_ta);
        Alert.show("Please enter your Comments.", "Error", Alert.OK);
        return false;
    }
    
    // if all the required fields have been filled in, create a LoadVars object instance and populate it.
    var send_lv:LoadVars = new LoadVars();
    send_lv.name = name_ti.text;
    send_lv.email = email_ti.text;
    send_lv.url = url_ti.text;
    send_lv.comments = comments_ta.text;
    send_lv.onLoad = function(success:Boolean) {
        // if the comments were sent to the server and you received a response, clear the form fields and display an Alert message.
        if (success) {
            name_ti.text = "";
            email_ti.text = "";
            url_ti.text = "";
            comments_ta.text = "";
            Alert.show("Thank you for your comments.", "Success", Alert.OK);
        } else {
            // else you encountered an error while submitting to the server.
            Alert.show("Unable to process your comments at this time.", "Server Error", Alert.OK);
        }
    };
    // send the variables from Flash to the remote PHP template.
    send_lv.sendAndLoad("http://www.moisait.xx/insert_sql.php", send_lv, "POST");
};
this.submit_button.addEventListener("click", postBtnListener);




2





//****************************************************************************
//Copyright (C) 2005 Macromedia, Inc. All Rights Reserved.
//The following is Sample Code and is subject to all restrictions on
//such code as contained in the End User License Agreement accompanying
//this product.
//****************************************************************************

stop();

var guestbook_ta:mx.controls.TextArea;

// create an XML object instance which is used to load comments from a remote server.
var guestbook_xml:XML = new XML();
guestbook_xml.ignoreWhite = true;
guestbook_xml.onLoad = function(success:Boolean) {
    if (success) {
        var numEntries = this.firstChild.childNodes.length;
        // loop through each of the entries from the XML packet...
        for (var i = 0; i<numEntries; i++) {
            // create a shortcut to the current child node
            var entry_xml:XMLNode = this.firstChild.childNodes[i].childNodes;
            
            /* set local variables for the name, email address, url, comments and timestamp. 
            Since you know the structure of the XML packet, you know the index of each of these child nodes. */
            var name_string:String = entry_xml[1].firstChild.nodeValue;
            var emailaddress_string:String = entry_xml[2].firstChild.nodeValue;
            var url_string:String = entry_xml[3].firstChild.nodeValue;
            var comments_string:String = entry_xml[4].firstChild.nodeValue;
            var datetime_string:String = entry_xml[6].firstChild.nodeValue;
            
            // the "entry_string" variable is used to hold the HTML formatted contents of the current guestbook entry
            var entry_string:String = "<p>";
            entry_string += "<span>"+name_string+"</span><br>";
            
            // if the email address isn't blank, append it to the current entry_string variable.
            if ((emailaddress_string != undefined) && (emailaddress_string.length>0)) {
                entry_string += "<a href=\"mailto:"+emailaddress_string+"\" target=\"_blank\">email</a><br>";
            }
            // if the url isn't blank, append it to the current entry_string variable.
            if ((url_string != undefined) && (url_string.length>0)) {
                // if the first five characters of the URL aren't "http:", set the prefix to "http://".
                var prefix_string:String = (url_string.substr(0, 5) != "http:") ? "http://" : "";
                entry_string += "<a href=\""+prefix_string+url_string+"\" target=\"_blank\">url</a><br>";
            }
            entry_string += comments_string+"<br>";
            entry_string += "<i>"+datetime_string+"</i><br>";
            entry_string += "</p>";
            // draw a horizontal line after each guestbook entry.
            entry_string += "<img src=\"line_gr\"><br>";
            // append each current entry to the current value of guestbook_ta
            guestbook_ta.text += entry_string+"<br>";
        }
    } else {
        trace("error loading XML");
    }
};

// load the guestbook XML entries from the remote server.
guestbook_xml.load("http://www.moisait.xx/select_sql.php");

// create a new instance of the TextField.StyleSheet object.
var styleObj = new TextField.StyleSheet();
styleObj.onLoad = function(success:Boolean) {
    if (success) {
        guestbook_ta.styleSheet = styleObj;
    }
};

// load the external style sheet
styleObj.load("http://www.helpexamples.com/flash/guestbook/astyles.css");


   
 
 автор: D.A.N_visator   (05.01.2007 в 14:10)   письмо автору
 
   для: D.A.N_visator   (05.01.2007 в 12:40)
 

i obrabotcic

<?php
  
include "sistem/config.php";
if ((!empty(
$name_ti)) && (!empty($email_ti)) && (!empty($comments_ta)));
    {
$query"INSERT INTO comments
         VALUES(NULL,
        '
$_POST[name_ti]',
        '
$_POST[email_ti]',
        '
$_POST[url_ti]',
        '
$_POST[comments_ta]')";
            if(
mysql_query($query))
               {
                      echo 
"success";
                } else exit (
"Error 14sqli - ".mysql_error());
         
    }    
?> 

   
 
 автор: Telemax   (05.01.2007 в 14:59)   письмо автору
 
   для: D.A.N_visator   (05.01.2007 в 14:10)
 

Если я правильно понимаю, то проверять то надо так

if ((!empty($_POST['name_ti'])) && (!empty($_POST['email_ti'])) && (!empty($_POST['comments_ta'])));

я ваши формы не смотрел, но надо еще быть уверенным, что именно POST , а не GET

   
 
 автор: D.A.N_visator   (05.01.2007 в 15:34)   письмо автору
 
   для: Telemax   (05.01.2007 в 14:59)
 

i na etom spasibo!
no tam v conde napisano otpraviti POSTom

   
 
 автор: Telemax   (05.01.2007 в 16:19)   письмо автору
 
   для: D.A.N_visator   (05.01.2007 в 15:34)
 

Но проверять-то все равно надо $_POST['var'], а не сразу $var

   
 
 автор: D.A.N_visator   (05.01.2007 в 18:27)   письмо автору
 
   для: Telemax   (05.01.2007 в 16:19)
 

s etim ea oshibsea, spasibo! vopros v tom cito provereati to i necevo! oni ne dohodeat(imeiut pustoe znacenie)

   
 
 автор: D.A.N_visator   (05.01.2007 в 18:42)   письмо автору
 
   для: D.A.N_visator   (05.01.2007 в 18:27)
 

v BD dobavleaiutsea pust&#238;e polea

   
 
 автор: AlexSol   (05.01.2007 в 19:15)   письмо автору
 
   для: D.A.N_visator   (05.01.2007 в 18:42)
 

по первому скрипту - используйте его.

var send_lv:LoadVars = new LoadVars(); 
    send_lv.name = name_ti.text; 
    send_lv.email = email_ti.text; 
    send_lv.url = url_ti.text; 
    send_lv.comments = comments_ta.text; 

вам нужно ловить переменные name email url comments

   
 
 автор: D.A.N_visator   (05.01.2007 в 22:16)   письмо автору
 
   для: AlexSol   (05.01.2007 в 19:15)
 

spasibo!

   
Rambler's Top100
вверх

Rambler's Top100 Яндекс.Метрика Яндекс цитирования