Jump to content

A novice requestin for help - PHP scripting


ajay_hk

Recommended Posts

Hi all,

 

A newbie here. I wanted some advice on the PHP script I'm working on for creating a flash website.

 

I'm working on a project of creating a flash portal for a small start up company and facing few issues with the PHP script. The webpage has a contact link on it wherein customers enter thier contact info such as name, address and thier request (this is a form). The script written has to send this request (with all the contact details) through.... I was having problems with that. A confirmation email is set up and that is working as expected, which would mean that the flash script is working. But I was not sure why the actual request is not getting through. It would be really helpful if you could please provide me some insight on where the problem might be or what do we have to refer to solve that. The script is as follows

 

<?PHP 

// Please change the value of these variables to your liking.
$YourWebpageAddress = "the website";

$YourSiteName = "website address";

$YourCompanyEmailAddress = "me@mycompany.com";

$to = "me@yahoo.com"; 

//===========================================================

// You can also change the value of these variables, but it is optional!

$subject = "You have a request.";

$headers = "From: My Website";

$forward = "";
$location = "";

//===========================================================

// 
Please don't change these lines ==========================

$date = date ("l, F jS, Y"); 

$time = date ("h:i A"); 

$msg = "Below is the result of your request form.
------------------------------------------------

Full Name: $FullName
Email Address: $EmailAddress
Company: $Company
Address: $Address
City: $City
State: $State
Zip Code: $ZipCode
Phone Number: $PhoneNumber
Extension: $Ext
Request: $Request

-------------------------------------------------
It was submitted on $date at $time.
Using: $HTTP_USER_AGENT
IP address: $REMOTE_ADDR
\n\n";

mail($to, $subject, $msg, $headers);


//Sending Confirmation Email to the user--------------------------------------------------------------------------------------;

$ConfirmationEmailMsg = "
Hi $FullName,
Thank you for contacting $YourSiteName.
We will contact you as soon as your request gets reviewed.

If you have any question regarding your request, please 
feel free to contact us at 1-030-333-0000.
Sincerely,

-----------------------------------------------------------
$YourSiteName .
$YourWebpageAddress
-----------------------------------------------------------
";

$ConfirmationEmailSubject = "Thanks For Contacting $YourSiteName.";

mail($EmailAddress, $ConfirmationEmailSubject, $ConfirmationEmailMsg, "From: $YourCompanyEmailAddress");

print "_root.contact.PHPStatus=Your request has been successfuly sent. You Will recieve a confirmation e-mail shortly.\n Thank you. \n $YourSiteName .";
?>

 

I'm a novice at PHP, actionscripting and flash. Before asking for help, I went through the forums to see if i could find something, but was not able to - due to time constraints, it would be really helpful if you could please take a look at the script and advice.

 

Thanks

Link to comment
Share on other sites

The two most likely problem I can think of are

 

1.  The arguments you gave to mail() are not valid.  This can be tough to track down.  You can try simplifying the arguments until it starts working.

Or

2.  Your email provider is blocking the email for some reason.

 

Edit: Your email provider may simply have delayed the email, due to suspicion of spam.  If this is the case, you'll get the emails but only much later.

Link to comment
Share on other sites

I noticed that the script is assuming that register globals.

 

First test the mail function itself.

Just after the first mail call , add a line explicitly testing that fxn.

mail('you@yourdomain.com','Subject Test','Body Test','From: foo@test.org');

if that works. mail() is fine.

 

Now test the variables

echo "<h1>$EmailAddress ?</h1>";

$EmailAddress was supposed to come from the form. Did it make it?

If so, you'd see it nice and big. The reason for the question mark is to see something in case $EmailAddress is empty.

 

Next, try,

echo "<h1>".$_POST['EmailAddress']." ?</h1>";

 

Did that make a difference?

If register globals is off, you'll have to use $_POST , $_GET, or $_REQUEST.  (REQUEST == $_GET & $_POST)

 

To test for those

var_dump($_POST);
var_dump($_GET);

 

Use what you find.

If these are null or flase, it's your form's fault.

 

 

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.