-
First try at PHP - help please.
Here's my first stab @ PHP - which is not working by the way.
Can someone provide some assistance please?
Here's the PHP script:
<?
$ToEmail = "mmpharmacy@mmpharmacy.com";
$ToName = "Morrocroft Medical Pharmacy";
$ToSubject = "Patient Profile Form";
$EmailBody = "Patient's name: $name-1\n\nPatient's address: $address-1\n$city-1\n\nPatient's telephone number: $telephone-1\n\nPrescription insurance provider: $provider-1\nID number: $id-1\nRX group number: $rx-1\n\nOther cardholders: $other-1";
$Message = $EmailBody;
mail($ToName." <".$ToEmail.">",$ToSubject, $Message, "From: ".$name-1.);
?>
Here's the 'submit' button code:
on (release) {
loadVariablesNum("patientprofileform.php", 0, "POST");
_root.gotoAndPlay(10);
}
Forms suck!!! Help please!
Jason.
-
Update...
Did more research, code now reads...
(STILL DOESN'T WORK)
<?php
$ToEmail = $_POST["ToEmail"];
$ToName = $_POST["ToName"];
$Subject = $_POST["Subject"];
$Name = $_POST["name-1"];
$Address = $_POST["address-1"];
$City = $_POST["city-1"];
$Telephone = $_POST["telephone-1"];
$Provider = $_POST["provider-1"];
$Id = $_POST["id-1"];
$Rx = $_POST["rx-1"];
$Other = $_POST["other-1"];
$Message = "Patient's name: $Name\n\nPatient's address: $Address\n$City\n\nPatient's telephone number: $Telephone\n\nPrescription insurance provider: $Provider\nID number: $Id\nRX group number: $Rx\n\nOther cardholders: $Other";
mail($ToEmail, $ToName, $ToSubject, $Message);
?>
Actionscript:
on (release) {
ToEmail = "mmpharmacy@mmpharmacy.com";
ToName = "Morrocroft Medical Pharmacy";
Subject = "Patient Profile Form";
loadVariablesNum("patientprofileform.php", 0, "POST");
_root.gotoAndPlay(10);
}
Any thoughts? This stuff is killing me...
Thanks in advance.
-
Hi,
unless your server really uses a very old version of php, you should add these lines near the top of the script:
$name = $_POST['name'];
$address = $_POST['address'];
$telephone = $_POST['telephone'];
$provider = $_POST['provider'];
$id = $_POST['id'];
$rx = $_POST['rx'];
$other = $_POST['other'];
What is the reason for these -1 things all over the place? If you have used them as part of your variable names - please get rid of them before they can bite
You mention _root - is this happening inside a movieclip? If yes, replace the loadVariablesNum with plain loadVariables and specify this as target
Musicman
-
maybe something else is wrong...
Thank you very much MM, but still doesn't seem to be working.
New php:
<?php
$toemail = $_POST['toemail'];
$toname = $_POST['toname'];
$subject = $_POST['subject'];
$name = $_POST['name'];
$address = $_POST['address'];
$city = $_POST['city'];
$telephone = $_POST['telephone'];
$provider = $_POST['provider'];
$id = $_POST['id'];
$rx = $_POST['rx'];
$other = $_POST['other'];
$message = "Patient's name: $name\n\nPatient's address: $address\n$city\n\nPatient's telephone number: $telephone\n\nPrescription insurance provider: $provider\nID number: $id\nRX group number: $rx\n\nOther cardholders: $other";
mail($toemail, $toname, $subject, $message);
?>
'submit' button script:
on (release) {
toemail = "mmpharmacy@mmpharmacy.com";
toname = "Morrocroft Medical Pharmacy";
subject = "Patient Profile Form";
this.loadVariables("patientprofileform.php", 0, "POST");
_root.gotoAndPlay(10);
}
Any other thoughts?
-
Hi,
is this already online for testing?
Musicman
-
-
Hi,
your movie does not seem to send anything to the server
The code you actually seem to be using in your movie is
this.loadVariablesNum('http://www.mmpharmacy.com/cgi-bin/Formmail.pl', 0, 'POST');
Change to
this.loadVariables('http://www.mmpharmacy.com/cgi-bin/Formmail.pl','POST')
Musicman
-
latest & greatest
Something I didn't know before was that I had to activate the PHP at my hosting provider. It has now been activated.
My new scripts that I just uploaded are as follows:
PHP:
<?php
$toemail = "mmpharmacy@mmpharmacy.com";
$toname = "Morrocroft Medical Pharmacy";
$subject = "Patient Profile Form";
$name = $_POST['name'];
$address = $_POST['address'];
$city = $_POST['city'];
$telephone = $_POST['telephone'];
$provider = $_POST['provider'];
$id = $_POST['id'];
$rx = $_POST['rx'];
$other = $_POST['other'];
$message = "Patient's name: $name\n\nPatient's address: $address\n$city\n\nPatient's telephone number: $telephone\n\nPrescription insurance provider: $provider\nID number: $id\nRX group number: $rx\n\nOther cardholders: $other";
mail($toemail, $toname, $subject, $message);
?>
'Submit' button:
on (release) {
this.loadVariables("patientprofileform.php", 0, "POST");
_root.gotoAndPlay(10);
}
Questions:
Am I using single vs. double quotes correctly?
Am I correctly pointing to PHP script from Flash?
Is the $toemail variable done correctly?
Any / all help is appreciated - Thank you.
-
suggestions...
I just found that the version of PHP my host is using is 4.3.2 if that makes for any changes to the code.
Help would be appreciated - this stuff is driving me nuts...
-
Hi,
this time it does not even seem to talk to the server - the problem is in your movie rather than in your scripting
Musicman
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|