?
Solved

How come php form isn't sending information to my email

Posted on 2009-02-19
27
Medium Priority
?
800 Views
Last Modified: 2013-12-12
I have a website i am working on which has a booking request form which i believe is using php script to send the form data.

My client would also like a field on the home page which users can enter their email and hit submit, and there email would:

1. Go into his database (http://sethgrabel.com/admin/) (not sure if this system supports that)
and also cc a copy of the email to his email: seth@sethgrabel.com

www.sethgrabel.com
0
Comment
Question by:Observer11
  • 13
  • 13
26 Comments
 
LVL 8

Expert Comment

by:agamal
ID: 23686708
this is how to send cc and bcc copies

<?php
mail('recipient@some.net, someone@some.net, metoo@some.net',
    'Subject', 'Your message here.',
    "To: The Receiver <recipient@some.net>\n" .
    "From: The Sender <sender@some.net>\n" .
    "cc: Interested <someone@some.net>\n" .
    "Bcc: Me Too <metoo@some.net>\n" .
    "X-Mailer: PHP 4.x");
?>

Open in new window

0
 
LVL 8

Expert Comment

by:agamal
ID: 23686712
0
 

Author Comment

by:Observer11
ID: 23687480
i see, so does this code have to be its own php file and then be referenced or is the current code on my page with the form (www.sethgrabel.com) ok and needs to simply be fixed within that index.htm page?
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 8

Expert Comment

by:agamal
ID: 23687501
you will need to replace your mail function with these lines in the page that sending emails

and replace the mails in the  the function above to the emails you want to send to
0
 

Author Comment

by:Observer11
ID: 23687546
by "mail function" do you mean a portion of the code in the index.htm page or a seperate php file?

(sorry im newb :)
0
 
LVL 8

Expert Comment

by:agamal
ID: 23687615
you have a mail function which sending mails ... i don't know which page .. but you need to edit this function ... if you can get this code and post it here we can help you more
0
 

Author Comment

by:Observer11
ID: 23687953
i believe this is the file.
thank you
<?
/*
##############################################################################
# PLEASE DO NOT REMOVE THIS HEADER!!!
#
# COPYRIGHT NOTICE
#
# FormMail.php v5.0
# Copyright 2000-2004 Ai Graphics and Joe Lumbroso (c) All rights reserved.
# Created 07/06/2000   Last Modified 10/28/2003
# Joseph Lumbroso, http://www.aigraphics.com, http://www.dtheatre.com
#                  http://www.dtheatre.com/scripts/
##############################################################################
#
# This cannot and will not be inforced but I would appreciate a link back
# to any of these sites:
# http://www.dtheatre.com
# http://www.aigraphics.com
# http://www.dtheatre.com/scripts/
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
#
##############################################################################
*/
 
// for ultimate security, use this instead of using the form
$recipient = "seth@sethgrabel.com"; // youremail@domain.com
 
// bcc emails (separate multiples with commas (,))
$bcc = "";
 
// referers.. domains/ips that you will allow forms to
// reside on.
$referers = array ('sethgrabel.com','www.sethgrabel.com','121.0.0.111');
 
// banned emails, these will be email addresses of people
// who are blocked from using the script (requested)
$banlist = array ('*@domain.com', 'user@domain.com', 'etc@domains.com');
 
// field / value seperator
define("SEPARATOR", ($separator)?$separator:": ");
 
// content newline
define("NEWLINE", ($newline)?$newline:"\n");
 
// formmail version (for debugging mostly)
define("VERSION", "5.0");
 
 
// our mighty error function..
function print_error($reason,$type = 0) {
   build_body($title, $bgcolor, $text_color, $link_color, $vlink_color, $alink_color, $style_sheet);
   // for missing required data
   if ($type == "missing") {
      if ($missing_field_redirect) {
         header("Location: $missing_field_redirect?error=$reason");
         exit;
      } else {
      ?>
      The form was not submitted for the following reasons:<p>
      <ul><?
      echo $reason."\n";
      ?></ul>
      Please use your browser's back button to return to the form and try again.<?
      }
   } else { // every other error
      ?>
      The form was not submitted because of the following reasons:<p>
      <?
   }
   echo "<br><br>\n";
   echo "<small>This form is powered by <a href=\"http://www.dtheatre.com/scripts/\">Jack's Formmail.php ".VERSION."</a></small>\n\n";
   exit;
}
 
// function to check the banlist
// suggested by a whole lot of people.. Thanks
function check_banlist($banlist, $email) {
   if (count($banlist)) {
      $allow = true;
      foreach($banlist as $banned) {
         $temp = explode("@", $banned);
         if ($temp[0] == "*") {
            $temp2 = explode("@", $email);
            if (trim(strtolower($temp2[1])) == trim(strtolower($temp[1])))
               $allow = false;
         } else {
            if (trim(strtolower($email)) == trim(strtolower($banned)))
               $allow = false;
         }
      }
   }
   if (!$allow) {
      print_error("You are using from a <b>banned email address.</b>");
   }
}
 
// function to check the referer for security reasons.
// contributed by some one who's name got lost.. Thanks
// goes out to him any way.
function check_referer($referers) {
   if (count($referers)) {
      $found = false;
 
      $temp = explode("/",getenv("HTTP_REFERER"));
      $referer = $temp[2];
      
      if ($referer=="") {$referer = $_SERVER['HTTP_REFERER'];
         list($remove,$stuff)=split('//',$referer,2);
         list($home,$stuff)=split('/',$stuff,2);
         $referer = $home;
      }
      
      for ($x=0; $x < count($referers); $x++) {
         if (eregi ($referers[$x], $referer)) {
            $found = true;
         }
      }
      if ($referer =="")
         $found = false;
      if (!$found){
         print_error("You are coming from an <b>unauthorized domain.</b>");
         error_log("[FormMail.php] Illegal Referer. (".getenv("HTTP_REFERER").")", 0);
      }
         return $found;
      } else {
         return true; // not a good idea, if empty, it will allow it.
   }
}
if ($referers)
   check_referer($referers);
 
if ($banlist)
   check_banlist($banlist, $email);
 
// This function takes the sorts, excludes certain keys and 
// makes a pretty content string.
function parse_form($array, $sort = "") {
   // build reserved keyword array
   $reserved_keys[] = "MAX_FILE_SIZE";
   $reserved_keys[] = "required";
   $reserved_keys[] = "redirect";
   $reserved_keys[] = "require";
   $reserved_keys[] = "path_to_file";
   $reserved_keys[] = "recipient";
   $reserved_keys[] = "subject";
   $reserved_keys[] = "sort";
   $reserved_keys[] = "style_sheet";
   $reserved_keys[] = "bgcolor";
   $reserved_keys[] = "text_color";
   $reserved_keys[] = "link_color";
   $reserved_keys[] = "vlink_color";
   $reserved_keys[] = "alink_color";
   $reserved_keys[] = "title";
   $reserved_keys[] = "missing_fields_redirect";
   $reserved_keys[] = "env_report";
   $reserved_keys[] = "submit";
   if (count($array)) {
      if (is_array($sort)) {
         foreach ($sort as $field) {
            $reserved_violation = 0;
            for ($ri=0; $ri<count($reserved_keys); $ri++)
               if ($array[$field] == $reserved_keys[$ri]) $reserved_violation = 1;
 
            if ($reserved_violation != 1) {
               if (is_array($array[$field])) {
                  for ($z=0;$z<count($array[$field]);$z++)
                     $content .= $field.SEPARATOR.$array[$field][$z].NEWLINE;
               } else
                  $content .= $field.SEPARATOR.$array[$field].NEWLINE;
            }
         }
      }
      while (list($key, $val) = each($array)) {
         $reserved_violation = 0;
         for ($ri=0; $ri<count($reserved_keys); $ri++)
            if ($key == $reserved_keys[$ri]) $reserved_violation = 1;
 
         for ($ri=0; $ri<count($sort); $ri++)
            if ($key == $sort[$ri]) $reserved_violation = 1;
 
         // prepare content
         if ($reserved_violation != 1) {
            if (is_array($val)) {
               for ($z=0;$z<count($val);$z++)
                  $content .= $key.SEPARATOR.$val[$z].NEWLINE;
            } else
               $content .= $key.SEPARATOR.$val.NEWLINE;
         }
      }
   }
   return $content;
}
 
// mail the content we figure out in the following steps
function mail_it($content, $subject, $email, $recipient) {
   global $attachment_chunk, $attachment_name, $attachment_type, $attachment_sent, $bcc;
 
   $ob = "----=_OuterBoundary_000";
   $ib = "----=_InnerBoundery_001";
   
   $headers  = "MIME-Version: 1.0\r\n"; 
   $headers .= "From: ".$email."\n"; 
   $headers .= "To: ".$recipient."\n"; 
   $headers .= "Reply-To: ".$email."\n";
   if ($bcc) $headers .= "Bcc: ".$bcc."\n"; 
   $headers .= "X-Priority: 1\n"; 
   $headers .= "X-Mailer: DT Formmail".VERSION."\n"; 
   $headers .= "Content-Type: multipart/mixed;\n\tboundary=\"".$ob."\"\n";
   
          
   $message  = "This is a multi-part message in MIME format.\n";
   $message .= "\n--".$ob."\n";
   $message .= "Content-Type: multipart/alternative;\n\tboundary=\"".$ib."\"\n\n";
   $message .= "\n--".$ib."\n";
   $message .= "Content-Type: text/plain;\n\tcharset=\"iso-8859-1\"\n";
   $message .= "Content-Transfer-Encoding: quoted-printable\n\n";
   $message .= $content."\n\n";
   $message .= "\n--".$ib."--\n";
   if ($attachment_name && !$attachment_sent) {
      $message .= "\n--".$ob."\n";
      $message .= "Content-Type: $attachment_type;\n\tname=\"".$attachment_name."\"\n";
      $message .= "Content-Transfer-Encoding: base64\n";
      $message .= "Content-Disposition: attachment;\n\tfilename=\"".$attachment_name."\"\n\n";
      $message .= $attachment_chunk;
      $message .= "\n\n";
      $attachment_sent = 1;
   }
   $message .= "\n--".$ob."--\n";
   
   mail($recipient, $subject, $message, $headers);
}
 
// take in the body building arguments and build the body tag for page display
function build_body($title, $bgcolor, $text_color, $link_color, $vlink_color, $alink_color, $style_sheet) {
   if ($style_sheet)
      echo "<LINK rel=STYLESHEET href=\"$style_sheet\" Type=\"text/css\">\n";
   if ($title)
      echo "<title>$title</title>\n";
   if (!$bgcolor)
      $bgcolor = "#FFFFFF";
   if (!$text_color)
      $text_color = "#000000";
   if (!$link_color)
      $link_color = "#0000FF";
   if (!$vlink_color)
      $vlink_color = "#FF0000";
   if (!$alink_color)
      $alink_color = "#000088";
   if ($background)
      $background = "background=\"$background\"";
   echo "<body bgcolor=\"$bgcolor\" text=\"$text_color\" link=\"$link_color\" vlink=\"$vlink_color\" alink=\"$alink_color\" $background>\n\n";
}
 
// check for a recipient email address and check the validity of it
// Thanks to Bradley miller (bradmiller@accesszone.com) for pointing
// out the need for multiple recipient checking and providing the code.
$recipient_in = split(',',$recipient);
for ($i=0;$i<count($recipient_in);$i++) {
   $recipient_to_test = trim($recipient_in[$i]);
   if (!eregi("^[_\\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\\.)+[a-z]{2,6}$", $recipient_to_test)) {
      print_error("<b>I NEED VALID RECIPIENT EMAIL ADDRESS ($recipient_to_test) TO CONTINUE</b>");
   }
}
 
// This is because I originally had it require but too many people
// were used to Matt's Formmail.pl which used required instead.
if ($required)
   $require = $required;
// handle the required fields
if ($require) {
   // seperate at the commas
   $require = ereg_replace( " +", "", $require);
   $required = split(",",$require);
   for ($i=0;$i<count($required);$i++) {
      $string = trim($required[$i]);
      // check if they exsist
      if((!(${$string})) || (!(${$string}))) {
         // if the missing_fields_redirect option is on: redirect them
         if ($missing_fields_redirect) {
            header ("Location: $missing_fields_redirect");
            exit;
         }
         $require;
         $missing_field_list .= "<b>Missing: $required[$i]</b><br>\n";
      }
   }
   // send error to our mighty error function
   if ($missing_field_list)
      print_error($missing_field_list,"missing");
}
 
// check the email fields for validity
if (($email) || ($EMAIL)) {
   $email = trim($email);
   if ($EMAIL) $email = trim($EMAIL);
   if (!eregi("^[_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,6}$", $email))
      print_error("your <b>email address</b> is invalid");
   $EMAIL = $email;
}
 
// check zipcodes for validity
if (($ZIP_CODE) || ($zip_code)) {
   $zip_code = trim($zip_code);
   if ($ZIP_CODE) $zip_code = trim($ZIP_CODE);
   if (!ereg("(^[0-9]{5})-([0-9]{4}$)", trim($zip_code)) && (!ereg("^[a-zA-Z][0-9][a-zA-Z][[:space:]][0-9][a-zA-Z][0-9]$", trim($zip_code))) && (!ereg("(^[0-9]{5})", trim($zip_code))))
      print_error("your <b>zip/postal code</b> is invalid");
}
 
// check phone for validity
if (($PHONE_NO) || ($phone_no)) {
   $phone_no = trim($phone_no);
   if ($PHONE_NO) $phone_no = trim($PHONE_NO);
   if (!ereg("(^(.*)[0-9]{3})(.*)([0-9]{3})(.*)([0-9]{4}$)", $phone_no))
      print_error("your <b>phone number</b> is invalid");
}
 
// check phone for validity
if (($FAX_NO) || ($fax_no)) {
   $fax_no = trim($fax_no);
   if ($FAX_NO) $fax_no = trim($FAX_NO);
   if (!ereg("(^(.*)[0-9]{3})(.*)([0-9]{3})(.*)([0-9]{4}$)", $fax_no))
      print_error("your <b>fax number</b> is invalid");
}
 
// sort alphabetic or prepare an order
if ($sort == "alphabetic") {
   uksort($HTTP_POST_VARS, "strnatcasecmp");
} elseif ((ereg('^order:.*,.*', $sort)) && ($list = explode(',', ereg_replace('^order:', '', $sort)))) {
   $sort = $list;
}
   
// prepare the content
$content = parse_form($HTTP_POST_VARS, $sort);
 
// check for an attachment if there is a file upload it
if ($attachment_name) {
   if ($attachment_size > 0) {
      if (!$attachment_type) $attachment_type =  "application/unknown";
      $content .= "Attached File: ".$attachment_name."\n";
      $fp = fopen($attachment,  "r");
      $attachment_chunk = fread($fp, filesize($attachment));
      $attachment_chunk = base64_encode($attachment_chunk);
      $attachment_chunk = chunk_split($attachment_chunk);
   }
}
 
// check for a file if there is a file upload it
if ($file_name) {
   if ($file_size > 0) {
      if (!ereg("/$", $path_to_file))
         $path_to_file = $path_to_file."/";
      $location = $path_to_file.$file_name;
      if (file_exists($path_to_file.$file_name))
         $location = $path_to_file.rand(1000,3000).".".$file_name;
      copy($file,$location);
      unlink($file);
      $content .= "Uploaded File: ".$location."\n";
   }
}
 
// second file (see manual for instructions on how to add more.)
if ($file2_name) {
   if ($file_size > 0) {
      if (!ereg("/$", $path_to_file))
         $path_to_file = $path_to_file."/";
      $location = $path_to_file.$file2_name;
      if (file_exists($path_to_file.$file2_name))
         $location = $path_to_file.rand(1000,3000).".".$file2_name;
      copy($file2,$location);
      unlink($file2);
      $content .= "Uploaded File: ".$location."\n";
   }
}
 
// if the env_report option is on: get eviromental variables
if ($env_report) {
   $env_report = ereg_replace( " +", "", $env_report);
   $env_reports = split(",",$env_report);
   $content .= "\n------ eviromental variables ------\n";
   for ($i=0;$i<count($env_reports);$i++) {
      $string = trim($env_reports[$i]);
      if ($env_reports[$i] == "REMOTE_HOST")
         $content .= "REMOTE HOST: ".$REMOTE_HOST."\n";
      if ($env_reports[$i] == "REMOTE_USER")
         $content .= "REMOTE USER: ". $REMOTE_USER."\n";
      if ($env_reports[$i] == "REMOTE_ADDR")
         $content .= "REMOTE ADDR: ". $REMOTE_ADDR."\n";
      if ($env_reports[$i] == "HTTP_USER_AGENT")
         $content .= "BROWSER: ". $HTTP_USER_AGENT."\n";
   }
}
 
// send it off
mail_it(stripslashes($content), ($subject)?stripslashes($subject):"Form Submission", $email, $recipient);
if (file_exists($ar_file)) {
   $fd = fopen($ar_file, "rb");
   $ar_message = fread($fd, filesize($ar_file));
   fclose($fd);
   mail_it($ar_message, ($ar_subject)?stripslashes($ar_subject):"RE: Form Submission", ($ar_from)?$ar_from:$recipient, $email);
}
 
// if the redirect option is set: redirect them
if ($redirect) {
   header("Location: $redirect");
   exit;
} else {
   echo "Thank you for your submission\n";
   echo "<br><br>\n";
   echo "<small>This form is powered by <a href=\"http://www.dtheatre.com/scripts/\">Jack's Formmail.php ".VERSION."!</a></small>\n\n";
   exit;
}
 
// <----------    THE END    ----------> //  

Open in new window

0
 
LVL 8

Expert Comment

by:agamal
ID: 23688096
you don't need to edit a lot

just add the other mail you want to $bcc ... at line 36

$recipient = "seth@sethgrabel.com"; // youremail@domain.com
 
// bcc emails (separate multiples with commas (,))
$bcc = "ENTER OTHER MAIL HERE";

Open in new window

0
 

Author Comment

by:Observer11
ID: 23688446
oh ok, thanks,.i see.
however the main issue im having is that the first or initial email isn't even getting the data when the user enters there email in the home page.. so if i put an email in the bcc field it most likely wouldn't be received either..

(this file is being used to send the data to seth@sethgrabel.com via his booking page on the site (http://www.sethgrabel.com/book_seth_grabel.php)

What i was thinking i could do was use this same code and duplicate it on the home page of this site which i did and just have the form data reduced to just ask for an email, but its just not seeming to work. (is this because you cant use one .php formmail file for 2 different page requests?
0
 
LVL 8

Expert Comment

by:agamal
ID: 23688530
you can desing a one from scratch ... booking for and submit it to you through mail ... it is easy and you will find a lot of resources to design it from scratch


we can help you  ... and you will find a lot of Q/A here related to this
0
 

Author Comment

by:Observer11
ID: 23688674
oh ok so do i just search in the database then?
0
 

Author Comment

by:Observer11
ID: 23688715
i looked on the database and copied an experts form but it still doesnt seem to be working :/
<HTML>
<HEAD>
<TITLE>Las Vegas, Los Angeles, Arizona Magician Seth Grabel : Home Page : World famous Entertainer</TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
.style1 {
	color: #FFFFFF;
	font-family: Geneva, Arial, Helvetica, sans-serif;
}
-->
</style>
</HEAD>
<BODY BGCOLOR=#000000 LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0 background="images/background2.jpg" link="#FFFF66" vlink="#C0C0C0" alink="#FFFFFF">
<!-- ImageReady Slices (demo5bb.jpg) -->
<div align="center">
  <center>
  <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100" id="AutoNumber1">
    <tr>
      <td width="100%">
<TABLE WIDTH=814 BORDER=0 CELLPADDING=0 CELLSPACING=0>
	<TR>
		<TD>
			<br>
			<IMG SRC="images/demo5bb_01.jpg" ALT="" width="276" height="185"></TD>
		<TD ROWSPAN=4 valign="bottom">
			<IMG SRC="images/demo5bb_02.jpg" ALT="" width="295" height="389"></TD>
		<TD ROWSPAN=4 valign="bottom">
			<IMG SRC="images/demo5bb_03.jpg" ALT="" width="243" height="389"></TD>
	</TR>
	<TR>
		      <TD> <a href="http://www.sethgrabel.com/index2.htm">
              <IMG SRC="images/demo5bb_04.jpg" ALT="" border="0" width="276" height="87"></a></TD>
	</TR>
	<TR>
		      <TD> <a href="production.php">
              <img src="images/demo5bb_05.jpg" alt="" border="0" width="276" height="53"></a></TD>
	</TR>
	<TR>
		      <TD> <a href="picturessub.php">
              <IMG SRC="images/demo5bb_06.jpg" ALT="" border="0" width="276" height="64"></a></TD>
	</TR>
	<TR>
		<TD>
			<IMG SRC="images/demo5bb_07.jpg" ALT="" width="276" height="156"></TD>
		<TD>
			<IMG SRC="images/demo5bb_08.jpg" ALT="" width="295" height="156"></TD>
		<TD>
			<IMG SRC="images/demo5bb_09.jpg" ALT="" width="243" height="156"></TD>
	</TR>
</TABLE>
<!-- End ImageReady Slices -->      </td>
    </tr>
</table>
  <FORM name=myform action=thankyou.php method=post><INPUT type=hidden value=ssend name=saction> 
 
<TABLE width=604 border=0 align="center" cellPadding=0 cellSpacing=5 style="WIDTH: 400">
 
<TBODY>
 
<TR>
 
<TD class=tittle><FONT class=tittle style2><FONT size=4>
  <HR align=left width="100%" color=white SIZE=1>
 
</FONT></FONT></TD>
</TR>
 
 
 
<TR>
 
<TD><INPUT name=email style="BACKGROUND-COLOR: #ffffa0" size=30>
  <FONT class=tittle><FONT size=4><strong><strong>
  <input type="submit" name="Submit2" id="Submit2" value="Submit">
  </strong></strong></FONT></FONT><span class="style1"><FONT size=4>  <br>
  <FONT size=4><FONT style2><strong>Submit your email to receive a free trick every month!</strong></FONT></FONT></FONT></span> </TD>
  <?php
$email = $_REQUEST['email'];
$mailto = 'design@mixvegasmedia.com.com' ;
$subject = "Would like to sign up for the trick of the month" ;
$thankyouurl = "http://www.sethgrabel.com/thankyou.php" ;
$messageproper .= "Message: Send the Following Email Address Info\r\nEmail: $_POST[email]\r\n";
mail($mailto, "$subject", "$messageproper", "From: Inforeqeust <seth@sethgrabel.com>");
header( "Location: $thankyouurl" );
exit ;
?>
</TR>
</TBODY></TABLE>
  </FORM></TD>
<TBODY><TR><TD class=tittle colSpan=3><FONT class=tittle><FONT size=4><HR align=left width="100%" color=white SIZE=1>
      <span class="style1">
      <label></label>
      </span></FONT></FONT></TD>
    <TBODY><TR><form name="form1" method="post" action="thankyou.php">
      <span class="style1">
        <label>    </label>
        <label></label>
      </span>
      <p align="center"><font face="Arial"><font color="#FFFFFF" size="2">
<a href="index2.htm">Seth Grabel</a></font><font size="2" color="#FFFF66">&nbsp; 
l&nbsp; </font><font color="#FFFFFF" size="2"><a href="production.php">
Productions</a><font size="2" color="#FFFF66">&nbsp; |&nbsp; </font>
<a href="picturessub.php">Photos</a><font size="2" color="#FFFF66"><br>
</font></font>
<FONT SIZE=2>                    <font color="#FFFF66">&copy; 2008 Seth Grabel.com All rights reserved |
</font> <a href="mailto:bookings@sethgrabel.com">seth@sethgrabel.com</a><FONT COLOR=#FFFF66> 
| 702.614.4559</font></font></font><font size="2"><br>
&nbsp;</font></p>
</BODY>
</HTML>

Open in new window

0
 
LVL 8

Expert Comment

by:agamal
ID: 23709058
sorry for being late

try this .... if it worked .. then add what you need from HTML and design

<?php if ($_POST['submit'] == "submit") {
$email = $_POST['email'];
$mailto = 'design@mixvegasmedia.com.com' ;
$subject = "Would like to sign up for the trick of the month" ;
$thankyouurl = "http://www.sethgrabel.com/thankyou.php" ;
$messageproper .= "Message: Send the Following Email Address Info\r\nEmail: $_POST[email]\r\n";
if (!mail($mailto, "$subject", "$messageproper", "From: Inforeqeust <seth@sethgrabel.com>")) {
echo "error message here";
} else {
header( "Location: $thankyouurl" );
}
}
?>
<form name="" method="post" action="">
<input name="email">
<input type="submit" name="submit" value="submit">
</form>

Open in new window

0
 

Author Comment

by:Observer11
ID: 23716001
thanks. but i get this error when i test it..

Method Not Allowed
The requested method GET is not allowed for the URL /index.htm.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
Apache/1.3.41 Server at sethgrabel.com Port 80

(do i have to input any additional data myself? ( noticed there's nothing between the action" " parenthasis

thanks!
0
 
LVL 8

Expert Comment

by:agamal
ID: 23716295
i retest again ... its working


also i added the action tab ... and it was working without it

<?php if ($_POST['submit'] == "submit") {
$email = $_POST['email'];
$mailto = 'design@mixvegasmedia.com.com' ;
$subject = "Would like to sign up for the trick of the month" ;
$thankyouurl = "http://www.sethgrabel.com/thankyou.php" ;
$messageproper .= "Message: Send the Following Email Address Info\r\nEmail: $_POST[email]\r\n";
if (!mail($mailto, "$subject", "$messageproper", "From: Inforeqeust <seth@sethgrabel.com>")) {
echo "error message here";
} else {
header( "Location: $thankyouurl" );
}
}
?>
<form name="form1" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<input name="email">
<input type="submit" name="submit" value="submit">
</form>

Open in new window

0
 

Author Comment

by:Observer11
ID: 23716665
hmm, still getting same error.. i noticed the mailto email has an extra .com at the end (design@mixvegasmedia.com.com) is it suppose to be like that?
0
 
LVL 8

Expert Comment

by:agamal
ID: 23716691
good comment .. no it is not ......

$mailto = 'design@mixvegasmedia.com' ;
0
 

Author Comment

by:Observer11
ID: 23716805
still not working, could it be because the file is an htm extension instead of html?
0
 
LVL 8

Expert Comment

by:agamal
ID: 23716947
no .... but i think you need to save it as php file ..... to make sure that php will process it
0
 

Author Comment

by:Observer11
ID: 23717503
hmm still doesn't seem to be working. Would it be maybe because im testing the mailto with my email and not the clients email (whos email is attached to the url) ?
0
 
LVL 8

Expert Comment

by:agamal
ID: 23719003
It appears that the form is sending the form information via the 'POST' method, whereas the .php file that is accepting the form information does not have any code to accept information sent via the 'POST' method, but probably has code to accept the information via the 'GET' method.


hvae you changed anything in the source code i sent ... i tested it for the 4th time and no errors
0
 

Author Comment

by:Observer11
ID: 23728154
hmm, i just repasted the code and now i see its working, however how would i make it so that after they hit submit - it directs them to my "thankyou.php" page?
0
 
LVL 8

Expert Comment

by:agamal
ID: 23728232
again it is working .... do you have an error or something ....
0
 

Author Comment

by:Observer11
ID: 23728539
yes i see it is working however i would like it do redirect them to my thank you page after hitting the "submit" button.

 Also, there is black error text on the actual page ..

("Warning: Cannot modify header information - headers already sent by (output started at /home2/mystical/public_html/index.php:5) in /home2/mystical/public_html/index.php on line 70")

..above the form. How do i remove this? (its not in the code)
0
 

Author Comment

by:Observer11
ID: 23903517
ok it seems to be re-directing to the thank you page now but i am still not receving any emails when i test the page..

i made sure my email in code is correct. i don't know why this isnt working
0
 
LVL 8

Accepted Solution

by:
agamal earned 250 total points
ID: 23905165
check with server admin
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses
Course of the Month13 days, 8 hours left to enroll

750 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question