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 protected]";
$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
https://forums.phpfreaks.com/topic/124086-form-mailer-help/
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 protected]";

$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 protected]";

so that [email protected] 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
https://forums.phpfreaks.com/topic/124086-form-mailer-help/#findComment-643551
Share on other sites

First off, I changed the true values of "[email protected]" 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
https://forums.phpfreaks.com/topic/124086-form-mailer-help/#findComment-643931
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.