Jump to content

Form Mailer Help


tstout2

Recommended Posts

Hey everyone! I am completely new to websites and to PHP, so go easy on me.

 

I purchased a Flash template website and it came with a form mailer PHP file. My hosting site (GoDaddy.com) requires you to use their PHP code.  I need help integrating the two so that my form mailer on my website works.

 

Thanks in advance for any help you guys can give!

 

 

Code from Flash template----

<?
$name=$_POST['name'];
$email=$_POST['email'];
$phone=$_POST['phone'];
$message=$_POST['message'];

$ToEmail = "email@domain.com";
$ToSubject = "Message from Domain";

$EmailBody =   "Name: $name\n 
			Email: $email\n
			Phone: $phone\n
			Message: $message\n";

$Message = $EmailBody;


$headers .= "Content-type: text; charset=iso-8859-1\r\n";
$headers .= "From:".$name." / ".$email."\r\n";

mail($ToEmail,$ToSubject,$Message, $headers);

?>

 

 

Code from GoDaddy.com----

<?php
$request_method = $_SERVER["REQUEST_METHOD"];
if($request_method == "GET")
{
	$query_vars = $_GET;
} 
elseif ($request_method == "POST")
{
	$query_vars = $_POST;
}

reset($query_vars);
$t = date("U");
$file = $_SERVER['DOCUMENT_ROOT'] . "\ssfm\gdform_" . $t;
$fp = fopen($file,"w");

while (list ($key, $val) = each ($query_vars)) 
{
	fputs($fp,"<GDFORM_VARIABLE NAME=$key START>\r\n"); 
	fputs($fp,"$val\r\n");
	fputs($fp,"<GDFORM_VARIABLE NAME=$key END>\r\n");
	if ($key == "redirect") 
	{ 
		$landing_page = $val;
	}
}

fclose($fp);

if ($landing_page != "")
{
	header("Location: http://".$_SERVER["HTTP_HOST"]."/$landing_page");
} 
else 
{
	header("Location: http://".$_SERVER["HTTP_HOST"]."/");
}
?>

Link to comment
Share on other sites

it dosn't make scence that go daddy would require you to use their script

 

i think your problem is here

 

$name=$_POST['name'];

$email=$_POST['email'];

$phone=$_POST['phone'];

$message=$_POST['message'];

 

$ToEmail = "email@domain.com";

$ToSubject = "Message from Domain";

 

by the looks of it this form is so people can send you an email

 

so first change

1. $ToEmail = "email@domain.com";

so that email@domain.com is your email;

2.  $ToSubject = "Message from Domain";

so that Message from Domain is the subject you want the email to be.

 

next lookup how to use a form with flash.

 

make the method = "POST" (all in caps) and the action the name of the script with extention and path

 

so if its in the same dir and its called script.php it would be action = "script.php" if it is in one directory up called path then it would be path/script.php

 

im guessing your template has a form already, it should be easy how to set the form.

 

Link to comment
Share on other sites

First off, I changed the true values of "email@domain.com" and "Message from Domain" for this posting.  Of course my template already has a form for this, and that is the code I pasted in my original message.  The code from the template is from a file called mail.php and the code from godaddy is gd_form.php. 

 

So how to I use these together?

 

 

tstout2

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.