ممنون hadimetal . کد من اینه:
send_btn.addEventListener(MouseEvent.CLICK, submit);
test_txt.addEventListener(MouseEvent.CLICK, clr);
var var_load:URLLoader = new URLLoader;
var URL_request:URLRequest = new URLRequest( "http://localhost/doctor.php" );
URL_request.method = URLRequestMethod.POST;
var_load.addEventListener(Event.COMPLETE, handleLoadSuccessful);
var_load.addEventListener(IOErrorEvent.IO_ERROR, handleLoadError);
function submit(e:MouseEvent):void
{
var URL_vars:URLVariables = new URLVariables("c="+ test_txt.text);
URL_vars.dataFormat = URLLoaderDataFormat.TEXT;
URL_request.data = URL_vars;
var_load.load( URL_request );
test_txt.text="";
}
function clr (e:MouseEvent):void{
test_txt.text="";
}
function handleLoadSuccessful($evt:Event):void
{
trace("Message sent.");
}
function handleLoadError($evt:IOErrorEvent):void
{
trace("Message failed.");
{
sent می شه اما توی DB ذخیره نمی شه.
کد php:
<?php
$db = mysql_connect("localhost","ali","1") or die("error");
mysql_select_db("epres2",$db) or die("select db");
$sql = "INSERT INTO doctor VALUES (".$_GET['c']."')";
mysql_query($sql) or die ("insert".mysql_error());
?>