sql - sending data from Flash to PHP to PHPmyadmin issue -
i've been trying around problem past 18 hours , cant find decent info on web!
here coding flash as3 file ....
import flash.events.mouseevent; import flash.net.urlloader; import flash.net.urlrequest; import flash.net.urlvariables; import flash.net.urlloaderdataformat; import flash.net.urlrequestmethod; import flash.events.event; var variables:urlvariables = new urlvariables(); var varsend:urlrequest = new urlrequest("form_parse.php"); varsend.method = urlrequestmethod.post; varsend.data = variables; var varloader:urlloader = new urlloader; varloader.dataformat = urlloaderdataformat.variables; varloader.addeventlistener(event.complete, completehandler); function completehandler(event:event):void { firstname_txt.text = ""; lastname_txt.text = ""; email_txt.text = ""; number_txt.text = ""; msg_txt.text = ""; } submit_btn.addeventlistener(mouseevent.click, validateandsend); function validateandsend (event:mouseevent):void { if(!firstname_txt.length) { status_txt.text = "please come in first name"; } else if (!lastname_txt.length) { status_txt.text = "please come in lastly name"; } else if (!email_txt.length) { status_txt.text = "please come in email"; } else if (!number_txt.length) { status_txt.text = "please come in phone number"; } else { variables.comtype="dp"; variables.userfname = firstname_txt.text; variables.userlname = lastname_txt.text; variables.useremail = email_txt.text; variables.usernumber = number_txt.text; variables.usermsg = msg_txt.text; varloader.load(varsend); } }
and here code php file...
<?php $username="******"; $password="******"; $database="******"; mysql_connect("*****","$username","$password") or die (mysql_error()); mysql_select_db("$database") or die (mysql_error()); if (@$_post['comtype'] == "dp") { $senderfname = $_post['userfname']; $senderlname = $_post['userlname']; $senderemail = $_post['useremail']; $sendernumber = $_post['usernumber']; $sendermessage = $_post['usermsg']; $sql = "insert form values('$senderfname','$senderlname','$senderemail','$sendernumber','$sendermessage')"; mysql_query($sql) or die (mysql_error()); mysql_free_result($sql); mysql_close(); echo "status_txt=entry has been added $senderfname, thanks!"; exit(); } ?>
can point out coding goes wrong? because checks i've done far coding correct, whenever seek run on local server cant btn send info php file... help right appreciated!
thanks dp
php sql actionscript-3 flash
No comments:
Post a Comment