Go Daddy hosting

gumspitter

New Member
Hello all, I need some help. I am using Godaddy for my hosting and am having some problems getting the form mailer to work. I am trying to the gdform.php form provided with my hosting account. Howeve when I insert the code and test the form in a browser I never get the email that the form is supposed to send to me. PLEASE HELP!!!!

PHP file <?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'] . "/../data/gdform_" . $t;
$fp = fopen($file,"w");
while (list ($key, $val) = each ($query_vars)) {
fputs($fp,"<GDFORM_VARIABLE NAME=$key START>\n");
fputs($fp,"$val\n");
fputs($fp,"<GDFORM_VARIABLE NAME=$key END>\n");
if ($key == "redirect") { $landing_page = $val;}
}
fclose($fp);
if ($landing_page != "http:// "){
header("Location: http://".$_SERVER["HTTP_HOST"]."/$landing_page");
} else {
header("Location: http://".$_SERVER["HTTP_HOST"]."/");
}


?>

HTML CODE:


<table width="60%" border="1" cellpadding="6" bgcolor="#091A2A">
<tr>
<td><form action="gdform.php " method="post" onsubmit="MM_validateForm('firstname','','R','lastname','','R');return document.MM_returnValue">First Name:
<input name="firstname" type="text" id="firstname" size="15
" maxlength="40">
<br />
Last Name:
<input name="lastname" type="text" id="lastname" size="15
" maxlength="40">
<br />
&nbsp;
<label onfocus="MM_validateForm('phone','','NisNum');return document.MM_returnValue">Phone Number
<input name="phone" type="text" id="phone" onblur="MM_validateForm('phone','','R');return document.MM_returnValue" size="15" maxlength="12" />
</label>
 

v2Media

Member
It's not an email script. It writes the form values to a file on the server at /../data/gdform_[date]
 

smoovo

New Member
Script for PHP email form.

To send email with PHP you have to use mail() function, as 'bcee' explained. I have attached here the basic code for using that function.

You can edit this form however you want.

PHP:
<html>
<body>

<?php
if (isset($_REQUEST['email']))
//if "email" is filled out, send email
  {
  //send email
  $email = $_REQUEST['email'] ;
  $subject = $_REQUEST['subject'] ;
  $message = $_REQUEST['message'] ;
  mail( "[email protected]", "Subject: $subject",
  $message, "From: $email" );
  echo "Thank you for using our mail form";
  }
else
//if "email" is not filled out, display the form
  {
  echo "<form method='post' action='mailform.php'>
  Email: <input name='email' type='text' /><br />
  Subject: <input name='subject' type='text' /><br />
  Message:<br />
  <textarea name='message' rows='15' cols='40'>
  </textarea><br />
  <input type='submit' />
  </form>";
  }
?>

</body>
</html>

This code provided by http://www.w3schools.com/PHP/php_mail.asp - Enjoy.

____________________
SMooVo- Web Design
[email protected]
www.SMooVo.com
 
Top