Ver Mensaje Individual
  #1 (permalink)  
Antiguo 22/10/2008, 19:41
Nohel
 
Fecha de Ingreso: octubre-2008
Mensajes: 3
Antigüedad: 16 años, 5 meses
Puntos: 0
¿¿¿insertar registros desde campo de texto flash a php???

RESULTA QUE ESTOY INTENTANDO INSERTAR UN REGISTRO A MI BASE DE DATOS DESDE FLASH PERO NO LOGRO OBTENER RESULTADOS EN MI SERVIDOR LOCAL... MI CÓDIGO ES EL SIGUIENTE...

****EN PHP****

Código PHP:
<?
$a
=1;


if(
a==1)
{
        
$HOSTNAME "localhost";//SERVIDOR
        
$USERNAME "root";        //USUARIO
        
$PASSWORD "una";        //CONTRASEÑA
        
$DATABASE "tutorialxl";    //BASE DE DATOS
    //nos conectamos a mysql.
        
function conectar(){
        global 
$HOSTNAME,$USERNAME,$PASSWORD,$DATABASE;
        
$idcnx mysql_connect($HOSTNAME$USERNAME$PASSWORD) or DIE(mysql_error());
        
mysql_select_db($DATABASE$idcnx);
        return 
$idcnx;
          }
           
$cnx conectar ();
        
$campos "nombre,pais,email";
        
$valores "'".$_POST['nombre']."',";
        
$valores .= "'".$_POST['apellido']."',";
        
$valores .= "'".$_POST['email']."',";
        
$sql "INSERT INTO email ($campos) VALUES($valores)";
        
$res mysql_query($sql) or die(mysql_error());
     echo 
"<&elTexto1=Registro ingresado&";
     
mysql_close($cnx);
 }
    else {
    echo 
"&elTexto1=Registro no ingresado&";
    
mysql_close($cnx);
    }
    
    
echo 
"&estatus=ok&";
?>
****Y EN FLASH ****

enviar.onRelease = function(){

lv = new LoadVars();
lv.nombre = nombre.text;
lv.email = email.text;
lv.pais = pais.text;
lv.sendAndLoad("http://localhost/07/nuevo.php", lv, "POST");
elTexto.text = "enviando mensaje";
nombre.text = " ";
email.text = " ";
pais.text = " ";


lv.onLoad = function() {
if (this.estatus == "ok") {

elTexto.text = "Tu mensaje fue enviado. nGracias.... =)";
nombre.text = " ";
email.text = " ";
pais.text = " ";

elTexto.text = "devuelto de php:\n\n"+
"Nombre: "+lv["nombre"]+"\n"+
"email:"+lv["email"]+"\n"+
"pais:"+lv["pais"];

elTexto1.text = " "+
"elTexto1:"+lv["elTexto1"]+"\n"+
"estatus:"+lv["estatus"];


} else {
elTexto.text = "Problemas con el servidornIntentalo de Nuevo";
}
}
};


LO MAS PROBABLE ES QUE SEA ALGUNA TONTERÍA, PERO NO LA ENCUENTRO

GRACIAS!