Jump to content

Recommended Posts

Okay, I'm new to these forums and I'm sure the answer to my question is a really simple one.

 

Here's the deal, I'm trying to set up a page so that visitors can input their email, and submit it so they can get signed up for my church's e-newsletter. When I test it, it seems to work fine, but since posting it I keep getting emails from Apache (not the user) saying "  would like to sign up for the eherald newsletter." It leaves the email address off. Maybe I'm doing something wrong with my email tag. Here's the code:

 

    <?php

 

$email = $_POST['email'];

 

$to = '[email protected]';

$subject = 'eherald signup';

$msg = "$email wants to sign up for the eherald newsletter.";

mail($to, $subject, $msg, 'From:' . $email);

 

echo 'You have been signed up for the e-herald newsletter.';

 

?>

 

I've got the page linked to the php just fine, but for some reason it's not including the email tag.

 

Thanks.

echo the email variable, and the post variable before you execute the mail function. it seems like the post variable is empty. The form name may be slightly off (missing a capitalization or something)

 

So you mean that the echo should be something like:

 

echo 'Congrats, $email. You have been signed up for the eherald.';

 

Not sure what you mean about echoing the post variable. I've checked the form name and it's right.

 

Here's what's going on at the html side of things:

<form id="form1" name="form1" method="post" action="signup.php">
       <label for="email">E-mail:</label>
       <input type="text" name="email" id="email" />
          <input type="submit" name="submit" id="submit" value="Sign me up!" />
     </form>

Okay, I've stuck that little bit of code in. We'll see if it works. It worked in the test, but then again, it did before also.

 

I'm surprised to hear that an echo command could be causing the problem. I figured it might have been something wrong with the version of php I'm using. I guess we'll see.

 

Thanks!

The echo wouldn't be causing the problem, its just a test to make sure that the variable is being populated with data as you expect it to be. Assuming that you have SMTP installed correctly on your server, and you aren't getting any error messages, your script should work.

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.