Jump to content

Recommended Posts

Hi,

 

I've had the following form working great on a website and it would send the email with the data.  A couple of days ago however, the form still accepts the information and goes to the 'thank you' page, yet now the email isn't coming through...???  Any ideas?  Here's the code for the pages:

 

On the form page:

 

<form action="process.php" method="POST">

 

On the 'process' page:

 

<?php

include("global.inc.php");

$errors=0;

$error="The following errors occured while processing your form input.<ul>";

pt_register('POST','name');

pt_register('POST','email');

pt_register('POST','S1');

pt_register('POST','Tour1');

pt_register('POST','T1');

pt_register('POST','Adults1');

pt_register('POST','FirstName');

pt_register('POST','SecondName');

pt_register('POST','Children1');

pt_register('POST','Children2');

pt_register('POST','Departure1');

pt_register('POST','Tour2');

pt_register('POST','T2');

pt_register('POST','Adults2');

pt_register('POST','FirstName2');

pt_register('POST','SecondName2');

pt_register('POST','Children21');

pt_register('POST','Children22');

pt_register('POST','Departure2');

pt_register('POST','Comments');

pt_register('POST','Cardtype');

pt_register('POST','Cardname');

pt_register('POST','Carddate');

pt_register('POST','Cardnumber');

pt_register('POST','Howfound');

if($email=="" ){

$errors=1;

$error.="<li>Please fill in your email address.";

}

if(!eregi("^[a-z0-9]+([_\\.-][a-z0-9]+)*" ."@"."([a-z0-9]+([\.-][a-z0-9]+)*)+"."\\.[a-z]{2,}"."$",$email)){

$error.="<li>Invalid email address entered";

$errors=1;

}

if($errors==1) echo $error;

else{

$where_form_is="http".($HTTP_SERVER_VARS["HTTPS"]=="on"?"s":"")."://".$SERVER_NAME.strrev(strstr(strrev($PHP_SELF),"/"));

$message="Name: ".$name."

Email: ".$email."

Pickup Address and Phone Number: ".$S1."

1st Tour: ".$Tour1."

Options: ".$T1."

Number of Adults: ".$Adults1."

Name of 1st Adult: ".$FirstName."

Name of 2nd Adult: ".$SecondName."

Number of Children: ".$Children1."

Names and Ages: ".$Children2."

Departure Date: ".$Departure1."

2nd Tour: ".$Tour2."

Options: ".$T2."

Number of Adults: ".$Adults2."

Name of 1st Adult: ".$FirstName2."

Name of 2nd Adult: ".$SecondName2."

Number of Children: ".$Children21."

Names and Ages: ".$Children22."

Departure Date: ".$Departure2."

Comments: ".$Comments."

Credit Cart Type: ".$Cardtype."

Card Holder Name: ".$Cardname."

Expiry Date: ".$Carddate."

Card Number: ".$Cardnumber."

How they found the website: ".$Howfound."

";

$message = stripslashes($message);

mail("sales@mydomain.com","New Booking!",$message,"From: Online Booking Received");

 

header("Refresh: 0;url=http://www.mydomain.com/thanks.html");

?><?php

}

?>

 

 

On the 'global' page:

 

<?php

 

function pt_register()

{

  $num_args = func_num_args();

  $vars = array();

 

  if ($num_args >= 2) {

      $method = strtoupper(func_get_arg(0));

 

      if (($method != 'SESSION') && ($method != 'GET') && ($method != 'POST') && ($method != 'SERVER') && ($method != 'COOKIE') && ($method != 'ENV')) {

          die('The first argument of pt_register must be one of the following: GET, POST, SESSION, SERVER, COOKIE, or ENV');

    }

 

      $varname = "HTTP_{$method}_VARS";

      global ${$varname};

 

      for ($i = 1; $i < $num_args; $i++) {

          $parameter = func_get_arg($i);

 

          if (isset(${$varname}[$parameter])) {

              global $$parameter;

              $$parameter = ${$varname}[$parameter];

          }

 

      }

 

  } else {

      die('You must specify at least two arguments');

  }

 

}

 

?>

 

 

 

have you tried sending to mulitiple addresses? I hit my head against the wall for about a week once thinking the code/server etc. was messed up, only to find out my isp had instituted a new spam filter that was catching it... Just a thought.

Someone had the right idea in checking to see if it was mailing, but the code didn't give a response to whether or not the mail was actually sent. Try this and tell us what the output is:

 

<?php

echo (mail('email@domain.com', 'test', 'test')) ? "mail was sent" : "mail wasn't sent";

?>

 

(note: change email@domain.com to a real address)

 

Come back here and tell us what was displayed to the screen.

If you ran that script exactly as I showed, with nothing else in other than what I showed, using a valid email address and not the one I showed, then there is a problem with your host. While the mail sent by that script may get filtered by junk mail filters, it should go out with no troubles at all.

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.