473,698 Members | 2,466 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

PHP script not returning data, please can you help

9 New Member
Hi, I've set up a form in flash which will send data to a PHP file on my web space, which in return will return the data from the textfields to my e-mail address. I know PHP is enabled in enabled on my web server because I tested it and it's OK.

Please can anyone check my PHP script below to see if I am missing something that would cause my e-mails not to be returned (I'm new to PHP).

I posted last week and I had to many parameters but I have now got them down to three so I hope that is OK so I am purely looking for the users input to be returned.

The PHP script is below (I've put the Actionscript code as well in-case someone notices something there)

I have tested this in an HTML page on my web server but no response from my form is received.

Thanks in advance.

PHP...
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. $to = 'me@myemailaddress.co.uk';
  3. $subject = 'Request';
  4.  
  5. $message = '';
  6. $message .= "\n";
  7. $message .= "Name: $fullName";
  8. $message .= "\n\n";
  9. $message .=  "Address: $fullAddress";
  10. $message .= "\n\n";
  11. $message .= "Postcode: $postcode";
  12. $message .= "\n\n";
  13. $message .= "Tel: $telNumber";
  14. $message .= "\n\n";
  15. $message .= "E-mail: $emailAddress";
  16.  
  17. $sent = mail ($to, $subject, $message);
  18. ?>
  19.  
Actionscript...
Expand|Select|Wrap|Line Numbers
  1. stop();
  2.     var fullName:TextField;
  3.     var fullAddress:TextField;
  4.     var postcode:TextField;
  5.     var telNumber:TextField;
  6.     var emailAddress:TextField;
  7.  
  8. fullName.restrict = "A-Za-zÁáÉéêíÍãõç ";
  9. fullName.maxChars = 40;
  10.  
  11. fullAddress.restrict = "0-9A-Za-zÁáÉéêíÍãõç!?.+\- ";
  12. fullAddress.maxChars = 90;
  13.  
  14. postcode.restrict = "0-9A-Za-zÁáÉéêíÍãõç!?.+\- ";
  15. postcode.maxChars = 10;
  16.  
  17. telNumber.restrict = "0-9A-Za-zÁáÉéêíÍãõç!?.+\- ";
  18. telNumber.maxChars = 20;
  19.  
  20. emailAddress.restrict = "0-9A-Za-zÁáÉéêíÍãõç!?.+\- ";
  21. emailAddress.maxChars = 50;
  22.  
  23. function sendEmail(fullName, fullAddress, postcode, telNumber, emailAddress)
  24. {    
  25.     var myData:LoadVars = new LoadVars();
  26.  
  27.     myData.fullName = fullName.text;
  28.     myData.fullAddress = fullAddress.text;
  29.     myData.postcode = postcode.text;
  30.     myData.telNumber = telNumber.text;
  31.     myData.emailAddress = emailAddress.text;
  32. }
  33.  
  34.     this.submitButton.onRelease = function()
  35.     {
  36.         if (fullName.text == "" || fullAddress.text == "" || postcode.text == "" || telNumber.text == "")
  37.     {
  38.         gotoAndStop("error");
  39.     }
  40.  
  41.     else
  42.  
  43.     {
  44.         sendEmail();
  45.         gotoAndStop("correct");
  46.     }
  47.  
  48.     myData.sendAndLoad("iopost.php", myData, "POST");    
  49. };
  50.  
Oct 19 '07 #1
3 1371
Atli
5,058 Recognized Expert Expert
Hi.

To use variables sent via the POST protocol in your PHP scripts, use the $_POST super-global.

Try something like:
Expand|Select|Wrap|Line Numbers
  1. $message = '';
  2. $message .= "\n";
  3. $message .= "Name: {$_POST['fullName']}";
  4. $message .= "\n\n";
  5. $message .=  "Address: {$_POST['fullAddress']}";
  6. # Etc...
  7.  
Oct 20 '07 #2
DMcN
9 New Member
Hi, thanks for the reply.

It looks as if my PHP script seems to be working now, thanks for the tip (although I could be wrong being new to PHP), but now when I point to the script in a browser window I get an e-mail sent to me but only the headings are there.

Name:
Address:
etc...

The information from the textfields in the SWF file are not being captured.

I think I may have to post in the flash section but thanks for your help, and the speedy reply.

I you feel this may still be a PHP problem please post any thoughts if you can and I'll keep a lookout for any info (I've put my latest script below just in-case).

Expand|Select|Wrap|Line Numbers
  1. <?php
  2. $to = 'me@myaddress.co.uk';
  3. $subject = 'Request';
  4.  
  5. $message = '';
  6. $message .= "\n";
  7. $message .= "Name: {$_POST['fullName']}";
  8. $message .= "\n\n";
  9. $message .=  "Address: {$_POST['fullAddress']}";
  10. $message .= "\n\n";
  11. $message .= "Postcode: {$_POST['postcode']}";
  12. $message .= "\n\n";
  13. $message .= "Tel: {$_POST['telNumber']}";
  14. $message .= "\n\n";
  15. $message .= "E-mail: {$_POST['emailAddress']}";
  16. $sent = mail ($to, $subject, $message);
  17. ?>
  18.  
Thanks.
Oct 20 '07 #3
Atli
5,058 Recognized Expert Expert
Hi again.

It's been a while since I've used Flash so I may be wrong here but...

You have an object, 'myData' defined inside a function 'sendEmail'. But you are using the object outside the scope of the 'sendEmail' function. I would have to guess that is the problem.

Try calling the 'sendAndLoad' method on the object inside the 'sendEmail' function.
Oct 23 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

5
2475
by: David M Loraine | last post by:
I am a sql novice and would appreciate any help with the following problem. In a table I have property addresses stored in 6 fields. Field6 always hold the Post Code. However, fields 4 and 5 are sometime NULL. Using the desktop integration package we have which interfaces with MS Word when printing an address in a letter the end results often end up looking like this. 1 Any Street AnyTown
6
1289
by: james | last post by:
CAn Some one please help when this scrip runs it does not enter the data from my forms, it just says where each feild should be. I have tested it using google address and it appears to work just fine. But i cma't get it to work with the below link. Thanks james <script> function doURL() { ncheckInDate=document.getElementById("checkInDate").value ncheckInMonth=document.getElementById("month").value
10
2042
by: Nimit | last post by:
Hi, I wasn't sure which forum this post belongs to, so I've posted it to a couple forums that I thought may be appropriate. In giving me advice, please consider me a beginner. Below is a synopsis of my problem/question: SOME BACKGROUND: - I am writing a php based web application. - There is a very data intensive task I need to do that requires reading and lookup of a lot of data.
0
3576
by: John Constant | last post by:
Using the MS C++ Example http://support.microsoft.com/default.aspx?scid=kb;en-us;261003 I've successfully managed to trap and log Script Errors that are generated by the WebBrowser (IE 6) which is hosted by a C# application, see below. However I've completely failed to force the browser to continue processing script which *should* be controlled by returning a true VT_BOOL via pvaOut. I've tried returning bool, System.Boolean even...
5
19594
by: Stacey Levine | last post by:
I have a webservice that I wanted to return an ArrayList..Well the service compiles and runs when I have the output defined as ArrayList, but the WSDL defines the output as an Object so I was having a problem in the calling program. I searched online and found suggestions that I return an Array instead so I modified my code (below) to return an Array instead of an ArrayList. Now I get the message when I try to run just my webservice...
7
10981
by: C.Joseph Drayton | last post by:
I have a problem that I am hoping someone can help me with. First let me describe the problem. I have an HTML form that in one field has an onBlur call to a JavaScript function. When you exit the field, it calls the JavaScript routine, which in turn calls a PHP script. The PHP script runs returns the value needed. And returns to the JavaScript. The JavaScript function is then supposed to set alerts depending on the values returned from...
2
1546
by: Dino | last post by:
dear all, i got this script form a customer. in general, it recieves data which is send via http to a server and generates a .xml file from this data. because i'm not familar with .asp, i'm totally lost transferring this script to php. i don't understand which way the data is recieved and how it's saved. as long this ia a very short script, i post it here. it would bne GREAT if
0
1419
by: Alex | last post by:
Hi, I am a complete beginner with Oracle 9i and XML within it, not XML alone though. I am trying to do a regular SELECT statement using the SQL Scratchpad within the Oracle Enterprise Manager and am trying to have it return XML rather than the usual rows of data. Someone told me to try this: SELECT SYS_XMLGEN (BRN_LAST_NAME) FROM "USCMS"."BROKER_NAME"
5
8636
by: Frank Hauptlorenz | last post by:
Hello, I recognized some days ago, that returning a DataTable blocks my WCF-Service. Is this a known bug? If I add this table to a new DataSet() and return this, it works. Thank you, Frank
0
8609
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9030
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8899
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8871
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7737
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6525
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4371
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2333
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2007
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.