Jump to content

Php X Flash: Post Issue


gleison_gomes

Recommended Posts

Hi, guys!

I have a system developed in PHP and Flash. It is divided into layers (MVC). I'm facing the following issue: the form, which is done in Flash, sends data to PHP via POST. I threw an exception printing what is coming from the form. When I click "Save" the data come black. As what I filled out the form remains on the screen, if I click again on "Save" the data are sent normally.

 

What can it be? Anyone got a light?

 

Thanks in advance!

Link to comment
Share on other sites

First and foremost you should be capturing/dumping the POST data somewhere, so that you can verify that it is indeed correct on the first submission (and identical to the second).

If that doesn't help, please post your code: Without it we have no idea what's actually happening, and thus have no idea on what the actual problem is.

Link to comment
Share on other sites

Sorry,

mistyping: "...data come black...". :-)

 

In the Flash form:

Servidor.sendAndLoad("Servidor.php?p1&p2&p3&ck=" + new Date().getTime(), Mensagem);

 

In the integration between Flash and PHP (php page):

$matricula = trim($_POST['Matricula']);

 

It's simple, but when I do this:

try

{

throw new Exception('Identificador: '. $_POST['Identificador'] . 'Mat: ' . $_POST['Matricula'] . 'Nome: ' . $_POST['Nome']);

}

catch(Exception $ex)

{

$mensagem = 'Erro='.urlencode($ex->getMessage());

echo die($mensagem);

}

 

The POST fields come blank at the first time and filled out in the second time on... weird...

Link to comment
Share on other sites

You'll need to debug this issue on the server side as well. Chances are extremely high that the problem is in your code, as a lot of people would be experiencing the same issues if the problem was with Apache.

As stated above: Dump the POST request, request URI and anything else that might be of interest, into a file. Then go through the process with a fine-toothed comb, and you should be able to spot where the problem occurs.

Link to comment
Share on other sites

  • 4 weeks later...

The server-side code that you did post, isn't even checking if a form has been submitted. It's likely the browser is (re)requesting the page for some other purpose that isn't a POST request or perhaps is submitting a post request itself, in addition to the flash, that doesn't contain any data.

 

What's the HTML of your page containing this flash form? It's likely invalid and one browser type is handling it differently than the other.

Edited by PFMaBiSmAd
Link to comment
Share on other sites

No one asked for a HTML FORM. They asked for -

 

What's the HTML of your page containing this flash form? It's likely invalid and one browser type is handling it differently than the other.

 

Until you post code that reproduces the problem, no one here will be able to help you find what is wrong with what you are doing.

Edited by PFMaBiSmAd
Link to comment
Share on other sites

I'm sorry. I misunderstand the question.

The HTML code is:

 

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<link href="imagens/grid.css" rel="stylesheet" type="text/css">

<title>XXX</title>

</head>

<body bgcolor="#cccccc">

<!--url's used in the movie-->

<!--text used in the movie-->

<!-- saved from url=(0013)about:internet -->

<div class="grid_azul"><span class="menusup-li">yyy</span><img src="imagens/marca-XXX.png" alt="XXX" width="183" height="25" class="img-marca"></div>

<div class="grid_branco"></div>

<div class="grid_verde"></div>

<div class="grid_amarela"></div>

<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.ma...ersion=7,0,0,0" width="780" height="890" id="suprimento" align="middle">

<param name="allowScriptAccess" value="sameDomain" />

<param name="movie" value="suprimento.swf" />

<param name="menu" value="false" />

<param name="quality" value="high" />

<param name="bgcolor" value="#cccccc" />

<embed src="suprimento.swf" menu="false" quality="high" bgcolor="#cccccc" width="780" height="890" name="suprimento" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://get.adobe.com...r/flashplayer/" />

</object>

</body>

</html>

Link to comment
Share on other sites

Thanks for the reply!

I've changed the code and it's valid now. However, I'm still facing the error.

 

The code now is:

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR...ml4/loose.dtd">

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<link href="imagens/grid.css" rel="stylesheet" type="text/css">

<title>xxx</title>

</head>

<body bgcolor="#cccccc">

<!--url's used in the movie-->

<!--text used in the movie-->

<!-- saved from url=(0013)about:internet -->

<div class="grid_azul"><span class="menusup-li">Suprimento</span><img src="imagens/marca.png" alt="eee" width="183" height="25" class="img-marca"></div>

<div class="grid_branco"></div>

<div class="grid_verde"></div>

<div class="grid_amarela"></div>

 

<object type="application/x-shockwave-flash" data="suprimento.swf?path=suprimento.swf" width="780" height="890">

<param name="movie" value="suprimento.swf">

</object>

 

</body>

</html>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.