Please find the problem with my ultra-simple submit e-mail address for

The email is not being delivered to the email addresses specified int

Page 1 of 1

2 Replies - 916 Views - Last Post: 03 December 2008 - 05:02 PM Rate Topic: -----

#1 abigailhamilton  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 03-December 08

Please find the problem with my ultra-simple submit e-mail address for

Posted 03 December 2008 - 04:45 PM

Hi there!

I have a form to submit an amail address to sign up for newsletters, and it's not delivering the submitted info correctly. I'm hoping this question is so easy that someone can quickly help me fix it! The form is live at http://jillbucy.com


<form method="post" action="">
<p class="body"><span class="style4">Receive Jill Bucy Skincare event invitations & news</span><br />
<span class="input-body">
<input name="Email" type="text" id="Email" size="30" maxlength="80" value="Simply enter your e-mail address" />
</span>
<input type="submit" name="Submit" value="Submit" />
</form>



And there's some php junk before the head:



<?php

$email = $HTTP_POST_VARS['Email'];

$mailto = "info@jillbucy.com, jillbucy@msn.com, jill@ah.candyhog.com, ah@candyhog.com";
$mailsubj = "Mailing list request";
$mailhead = "From: ".$email."\n";
$err = 0;
if ( strlen($name)<3 || strlen($numberofguests)<1 || strlen($email)<5) {
$err=1;
}

if (!$err) {
reset ($HTTP_POST_VARS);
$mailbody = "A visitor would like to be added to the email list for invites and newsletters:\n";
while (list ($key, $val) = each ($HTTP_POST_VARS)) { $mailbody .= $key." : ".$val."\n"; }
/// if (!eregi("\n",$HTTP_POST_VARS[email])) { mail($mailto, $mailsubj, $mailbody, $mailhead); }
mail($mailto, $mailsubj, $mailbody, $mailhead);
$email = '';

}
?>




Thanks in advance!

This post has been edited by abigailhamilton: 03 December 2008 - 04:46 PM


Is This A Good Question/Topic? 0
  • +

Replies To: Please find the problem with my ultra-simple submit e-mail address for

#2 Valek  Icon User is offline

  • The Real Skynet
  • member icon

Reputation: 543
  • View blog
  • Posts: 1,713
  • Joined: 08-November 08

Re: Please find the problem with my ultra-simple submit e-mail address for

Posted 03 December 2008 - 04:51 PM

Unless you're using an older version of PHP, you're actually using the deprecated name of the post variable array. Try it again, replacing all instances of $HTTP_POST_VARS with $_POST, and see if that resolves the issue.
Was This Post Helpful? 0
  • +
  • -

#3 Valek  Icon User is offline

  • The Real Skynet
  • member icon

Reputation: 543
  • View blog
  • Posts: 1,713
  • Joined: 08-November 08

Re: Please find the problem with my ultra-simple submit e-mail address for

Posted 03 December 2008 - 05:02 PM

Also, on second glance, replace this:

while (list ($key, $val) = each ($HTTP_POST_VARS)) { $mailbody .= $key." : ".$val."\n"; }


with this:

foreach($_POST as $key => $val) { $mailbody .= $key." : ".$val."\n"; }


Using this, you can also remove your reset() call, as foreach() automatically resets the array pointer before execution. If you use the array pointer after that, however, you will need to call reset() then.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1