Jump to content

Recommended Posts

Ok the url is [a href=\"http://www.funnyemailforwards.com/contactus.php\" target=\"_blank\"]page[/a]
The problem is the everything is working great, but the bottom section where I am sending the mail, the message that is suppose to appear if it is sent, is displaying first thing, and emailing it as soon as the page opens, don't I have the control structure set up right, I didn't want to test each and every field individually, I wanted to test them all like this, and have it display all error messages it runs across, but this didn't work, I also tried with if, the else if, then else at the end but it only displayed one error at a time, and I am not ready to start learning how to create an array with them and do it that way, I am learning very fast, getting better and better, and forcing myself into difficult situations to learn, but I am learning, and I don't want to rush that, until I have 100% understanding over control structures this is where my problem currently lies.

[code]<?php
if (isset($_POST['submit'])){
    if (empty($_POST['name'])){
    print('The name field has been left blank<br />');
    }if (empty($_POST['emailaddress'])){
    print('The Email Address field was left blank<br />');
    }if (empty($_POST['verifyemail'])){
    print('The Verify Email Field was left blank<br />');
    }if ($_POST['emailaddress'] != $_POST['verifyemail']){
    print('The Email Addresses do not match, please fix this<br />');
    }if (empty($_POST['description'])){
    print('The Description Field was left blank<br />');
    }}else {
    $to = "businessman332211@hotmail.com";
    $subject = "FunnyEmailForwards.com contact";
    $name = $_POST['name'];
    $emailaddress = $_POST['emailaddress'];
    $verifyemail = $_POST['verifyemail'];
    $description = $_POST['description'];
    $from = "$emailaddress";
    $message = "
    Name: {$name}
    Email Address: {$emailaddress}
    Verify Email: {$verifyemail}
    What the person had to say:
    {$description}
    ";
        if (mail($to, $subject, $message, $From)){
        print('Thank you for contacting us!<br />');
        print('We will try and get back to you within 24 hours.<br />');
        }else{
        print('There was an error sending the message, please try again!<br />');
        print('If it does not work the second time, please send an email directly to<br />');
        print('<a href="mailto:businessman332211@hotmail.com">Here</a>');
        }};
    
    
    
?>[/code]
Link to comment
https://forums.phpfreaks.com/topic/11343-problems-with-mail/
Share on other sites

Somehow your $_POST contains a variable called "submit". That's the only way I can figure this doesn't work. Try changing the name of the submit button to something else and then modifying your first if statement.

Also, this should be above the form, not below it.

One more thing, when you submit, it doesn't refill the form with the info you already submitted. You might want to fix that. And it wouldn't hurt to say what was required and what wasn't. If it's all required, say so.
Link to comment
https://forums.phpfreaks.com/topic/11343-problems-with-mail/#findComment-42486
Share on other sites

I made the changes, It didn't make the form disappear this time for some reason, but it still has the same thing, and I changed that with the form, I changed it to send instead of submit, and changed the variable too, where should I put printr should I replace all my current print statements with it.

[code]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Contact Us</title>
</head>
<body>
<h3>Contact Us</h3>
<p><a href="index.php" title="Return Home">Return Home</a></p>
<p>If you need to contact us for any reason you can do so below.  We will try and respond within 24 hours.</p>
<br />
<?php
if (isset($_POST['send'])){
    if (empty($_POST['name'])){
    print('The name field has been left blank<br />');
    }if (empty($_POST['emailaddress'])){
    print('The Email Address field was left blank<br />');
    }if (empty($_POST['verifyemail'])){
    print('The Verify Email Field was left blank<br />');
    }if ($_POST['emailaddress'] != $_POST['verifyemail']){
    print('The Email Addresses do not match, please fix this<br />');
    }if (empty($_POST['description'])){
    print('The Description Field was left blank<br />');
    }}else {
    $to = "businessman332211@hotmail.com";
    $subject = "FunnyEmailForwards.com contact";
    $name = $_POST['name'];
    $emailaddress = $_POST['emailaddress'];
    $verifyemail = $_POST['verifyemail'];
    $description = $_POST['description'];
    $from = "$emailaddress";
    $message = "
    Name: {$name}
    Email Address: {$emailaddress}
    Verify Email: {$verifyemail}
    What the person had to say:
    {$description}
    ";
        if (mail($to, $subject, $message, $From)){
        print('Thank you for contacting us!<br />');
        print('We will try and get back to you within 24 hours.<br />');
        }else{
        print('There was an error sending the message, please try again!<br />');
        print('If it does not work the second time, please send an email directly to<br />');
        print('<a href="mailto:businessman332211@hotmail.com">Here</a>');
        }};
    
    
    
?>
<form name="contact" id="contact" action="contactus.php" method="post">
<label for="name">Name:</label><br />
<input name="name" id="name" type="text" maxlength="80" /><br />
<label for="emailaddress">Email Address:</label><br />
<input name="emailaddress" id="emailaddress" type="text" maxlength="80" /><br />
<label for="verifyemail">Verify Email Address:</label><br />
<input name="verifyemail" id="verifyemail" type="text" maxlength="80" /><br />
<label for="description">Message:</label><br />
<textarea name="description" id="description" cols="20" rows="7" />
</textarea><br />
<input name="send" id="send" type="submit" value="Contact Us!" />
<input name="reset" id="reset" type="reset" value="Clear Form" />
</form>
</body>
</html>[/code]

See I did decide a few things, on forms where I am doing databasing, or handling more than one submit button or more than one form, I always want to do it on another page. But when I have some basic contact form, or something simple, I like the idea of having it on the same page, I know all of this is subject to opinion, so I thought through all of this, the thing I don't get also is when it's on another page repopulating the form fields isn't an issue, so why does it clear it when it's on the same page, when it's a different page they hit back and they are still there, they fix the errors and boom, here what happens is it removes itself, how do I repopulate the form fields, and why does it work like that.
Link to comment
https://forums.phpfreaks.com/topic/11343-problems-with-mail/#findComment-42499
Share on other sites

print_r($array_name) prints out the contents of an array. I wanted you to throw that in at the top so you can see what variables are actually in the $_POST array.

When you submit a form, all the current values will be in the $_POST array, so in your form you do something like this:

<input name="emailaddress" id="emailaddress" type="text" maxlength="80" value="<?=isset($_POST['emailaddress']) ? $_POST['emailaddress'] : ''?>" />

By the way, you have a double closing bracket before your else. If you move one of those to the end of the PHP block, I think that will fix your issues with having it send on the loading of the page.
Link to comment
https://forums.phpfreaks.com/topic/11343-problems-with-mail/#findComment-42501
Share on other sites

Ok, I got in the repopulation, it repopulates now, what I need to figure out is why that message is still displaying and for some reason it's emailing it to me automatically at the open of the page. I am going to see if I can break down and understand the repopulation so I can do it later from memory, any advice on the other would be appreciated too, thanks so far, I need to learn the repopulation too.

I have to do that, or I get a parse error, it's because I have it wrapped in a bigger construct. The if at the top get's closed there, along with the end of the last if statement used in that segment.
Link to comment
https://forums.phpfreaks.com/topic/11343-problems-with-mail/#findComment-42505
Share on other sites

Oh ok, that makes sense, I will redo it and tell you the parse area.
When I change it and take that out I get
[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]Parse error: parse error, unexpected $ in /home/all/funnyemailforwards/public_html/contactus.php on line 66
[/quote]
and that is on the line with nothing, for some reason that is way out all the way at the end of the document, pass the html, why is my php trying to read there?

Actually I got it working, What I did was added that at the end instead of where it was.
Link to comment
https://forums.phpfreaks.com/topic/11343-problems-with-mail/#findComment-42509
Share on other sites

A few other things happened.
That aren't working, for one I repopulated my text area field like you said but it's not repopulating, another thing is, how do I get it to remove the form when it submits all the way, or is it suppose to do that.

Just the bottom text area, teh one with description, and the form stays there for some reason, and let's you submit really rapidly.

I was also wondering, I figured out how to set the from address, but he wants the from field itself to say FunnyEmailForwards.com instead of an email address is this possible, to set a header as text instead of email, I tried but it doesn't register it, it still puts some wierd damon, at the website, whatever.
Link to comment
https://forums.phpfreaks.com/topic/11343-problems-with-mail/#findComment-42512
Share on other sites

You need to use headers to set the from address. Look up the mail() function... it lays it out nicely.

And if you want to hide the form after the submit, all you have to do is build up an "error code" of some sort so that if it fails validation, it'll show the form, otherwise it won't.
Link to comment
https://forums.phpfreaks.com/topic/11343-problems-with-mail/#findComment-42515
Share on other sites

To build the error code, you're going to do something like this:
[code]    
    $error_code = false;
    if (empty($_POST['name'])){
    $error_code = true;
    print('The name field has been left blank<br />');
    }if (empty($_POST['emailaddress'])){
    $error_code = true;
    print('The Email Address field was left blank<br />');
    }if (empty($_POST['verifyemail'])){
    $error_code = true;
    print('The Verify Email Field was left blank<br />');
    }if ($_POST['emailaddress'] != $_POST['verifyemail']){
    $error_code = true;
    print('The Email Addresses do not match, please fix this<br />');
    //etc[/code]
So then you just check that variable to see if it ran into an error or not.

I'm going to guess that your description block is a text area and you're trying to set a value. The text area doesn't have a value... you just have to echo the value between the open and closing tags (but that's just a guess... ).

As far as the from header... maybe you should show us your latest code (after you add the above parts).
Link to comment
https://forums.phpfreaks.com/topic/11343-problems-with-mail/#findComment-42525
Share on other sites

Ok I have done 2 things.

First, is there a way to make the form disappear after submission other than that, I want to avoid getting into something so deep I don't understand it yet, I don't understand at all the functionality of the error code, I need to get this down I think before I dig into that, I tried doing adjustments to the from field, to set the header, and I tried a weak attempt at getting the text area to repopulate but they both failed, the email is still giving me this wierd email address of the domain manager, but I needed it to say FunnyEmailForwards.com, I have to get this to work because I talked him into using forms instead of mailto links. Also I need to get the field to populate itself but that didn't work.
The other thing is giving me an error here
[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]
Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/all/funnyemailforwards/public_html/contactus.php on line 63
[/quote]

[code]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Contact Us</title>
</head>
<body>
<h3>Contact Us</h3>
<p><a href="index.php" title="Return Home">Return Home</a></p>
<p>If you need to contact us for any reason you can do so below.  We will try and respond within 24 hours.</p>
<br />
<?php
if (isset($_POST['send'])){
    if (empty($_POST['name'])){
    print('The name field has been left blank<br />');
    }if (empty($_POST['emailaddress'])){
    print('The Email Address field was left blank<br />');
    }if (empty($_POST['verifyemail'])){
    print('The Verify Email Field was left blank<br />');
    }if ($_POST['emailaddress'] != $_POST['verifyemail']){
    print('The Email Addresses do not match, please fix this<br />');
    }if (empty($_POST['description'])){
    print('The Description Field was left blank<br />');
    }else {
    $to = "businessman332211@hotmail.com";
    $subject = "FunnyEmailForwards.com contact";
    $name = $_POST['name'];
    $emailaddress = $_POST['emailaddress'];
    $verifyemail = $_POST['verifyemail'];
    $description = $_POST['description'];
    $from = "FunnyEmailForwards.com Contact";
    $message = "
    Name: {$name}
    Email Address: {$emailaddress}
    Verify Email: {$verifyemail}
    What the person had to say:
    {$description}
    ";
        if (mail($to, $subject, $message, $From)){
        print('Thank you for contacting us!<br />');
        print('We will try and get back to you within 24 hours.<br />');
        }else{
        print('There was an error sending the message, please try again!<br />');
        print('If it does not work the second time, please send an email directly to<br />');
        print('<a href="mailto:businessman332211@hotmail.com">Here</a>');
        }}
        };
    
    
    
?>
<form name="contact" id="contact" action="contactus.php" method="post">
<label for="name">Name:</label><br />
<input name="name" id="name" type="text" maxlength="80" value="<?=isset($_POST['name']) ? $_POST['name'] : ''?>"/><br />
<label for="emailaddress">Email Address:</label><br />
<input name="emailaddress" id="emailaddress" type="text" maxlength="80" value="<?=isset($_POST['emailaddress']) ? $_POST['emailaddress'] : ''?>"/><br />
<label for="verifyemail">Verify Email Address:</label><br />
<input name="verifyemail" id="verifyemail" type="text" maxlength="80" value="<?=isset($_POST['verifyemail']) ? $_POST['verifyemail'] : ''?>"/><br />
<label for="description">Message:</label><br />
<textarea name="description" id="description" cols="20" rows="7" />
<?php
if (isset($_POST['description'])){
echo("$_POST['description']");
}; ?>
</textarea><br />
<input name="send" id="send" type="submit" value="Contact Us!" />
<input name="reset" id="reset" type="reset" value="Clear Form" />
</form>
</body>
</html>[/code]

Link to comment
https://forums.phpfreaks.com/topic/11343-problems-with-mail/#findComment-42531
Share on other sites

*sigh*... so much you have to learn about giving us enough info.

1) WHAT LINE IS 63?????
2) You can't hide the form without some kind of error code validation.
3) Is the text area filled in now?
4) You're still not using any headers. Did you read the manual entry for mail()???
Link to comment
https://forums.phpfreaks.com/topic/11343-problems-with-mail/#findComment-42533
Share on other sites

Sorry about that, line 63 is
[code]echo("$_POST['description']");[/code]

No it's still not displaying, and I had another suggestion about putting the form into an if-else statement, somehow and doing it that way is that possible, I will play around with and try to learn this error code thing, I am starting to think it's a better idea to do it on another page, is it easier that way.

The headers I was using was setting the header variable to what I needed and then putting it into the mail like this

Setting header
[code]$from = "FunnyEmailForwards.com Contact";[/code]
Putting it into the mail function
[code]if (mail($to, $subject, $message, $From)){
        print('Thank you for contacting us!<br />');
        print('We will try and get back to you within 24 hours.<br />');
        }else{
        print('There was an error sending the message, please try again!<br />');
        print('If it does not work the second time, please send an email directly to<br />');
        print('<a href="mailto:businessman332211@hotmail.com">Here</a>');
        }}
        };[/code]
and for some reason it's not changing it.

also I noticed lately when I go to the page, type something in the description area, it sends the email and validates it, as soon as something enters into the description it sends the email, everytime I do it in another page, it always worked first thing, but now it's giving me issues, but I guess I am learning from it.
Link to comment
https://forums.phpfreaks.com/topic/11343-problems-with-mail/#findComment-42539
Share on other sites

[a href=\"http://us3.php.net/manual/en/function.mail.php\" target=\"_blank\"]http://us3.php.net/manual/en/function.mail.php[/a]

Look at the "how to send HTML emails part:
[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]// To send HTML mail, the Content-type header must be set
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

// Additional headers
$headers .= 'To: Mary <mary@example.com>, Kelly <kelly@example.com>' . "\r\n";
$headers .= 'From: Birthday Reminder <birthday@example.com>' . "\r\n";
$headers .= 'Cc: birthdayarchive@example.com' . "\r\n";
$headers .= 'Bcc: birthdaycheck@example.com' . "\r\n";

// Mail it
mail($to, $subject, $message, $headers);[/quote]

Change:
[code]if (isset($_POST['description'])){
echo("$_POST['description']");
}; ?>[/code]
To:
[code]if (isset($_POST['description'])){
echo $_POST['description'];
} ?>[/code]
You don't need the parenthesis or the quotes when you're just echoing a variable (I never use the parenthesis otherwise either).

I also don't understand why you had a ";" after the if closing bracket. That's completely unnecessary.

This:
[code]<?=isset($_POST['emailaddress']) ? $_POST['emailaddress'] : ''?>[/code]
may not work as intended. It's short-code and I always screw it up. You may want to break that out.
if(isset($_POST['emailaddress']))
echo $_POST['emailaddress'];
else
echo "";

Link to comment
https://forums.phpfreaks.com/topic/11343-problems-with-mail/#findComment-42543
Share on other sites

Ok, now I got the form field working, thanks the text-area works, and now I know how to do it, from now on should I ALWAYS leave off the parenthesis on echo, or echo and print, or what. I just need clarification for learning purposes.
It's also doing something funny, when you go to the site, if you type something in description and click submit it submits it automatically.
You can fill out the others, and click it it gives you error messages, but no matter what when you fill out description and click submit, it displays the message it is suppose to for confirmation, sends an email, and still validates and shows up the error messages, I am confused as to why this is happening, I didn't notice it until now.
and at the part where you showed me to change those over to the longer forms, I tried that but it didn't work, can you show me an example in a form field.
Link to comment
https://forums.phpfreaks.com/topic/11343-problems-with-mail/#findComment-42551
Share on other sites

Try it like this:
[code]<?php
$email = "";
if(isset($_POST['emailaddress']))
    $email =  $_POST['emailaddress'];
?>
<input name="emailaddress" id="emailaddress" type="text" maxlength="80" value="<?=$email?>"/><br />
[/code]

The reason it's doing that is because you have no way of checking to see if any of the other validations have failed. That's where the error code comes into play.

Right now your code says this:
[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]if email is blank show error
if name is blank show error
if description is blank show error but if it's not go ahead and send the email.[/quote]

As it is, your "else" statement is only tied to the description.
Link to comment
https://forums.phpfreaks.com/topic/11343-problems-with-mail/#findComment-42558
Share on other sites

Ok I think I get the point a little, so I can still use the same thing I am doing, I could take my current setup and just attribute them into error, I like this part

[code]if (isset($_POST['send'])){
    if (empty($_POST['name'])){
    print('The name field has been left blank<br />');
    }if (empty($_POST['emailaddress'])){
    print('The Email Address field was left blank<br />');
    }if (empty($_POST['verifyemail'])){
    print('The Verify Email Field was left blank<br />');
    }if ($_POST['emailaddress'] != $_POST['verifyemail']){
    print('The Email Addresses do not match, please fix this<br />');
    }if (empty($_POST['description'])){
    print('The Description Field was left blank<br />');[/code]
I like the way that looks, the way it operates and the way it functions, doing it one at a time, I know the code is longer, but it's funner, it helps me learn it faster, and understand this, before I start using arrays to do it, which I will later after I can do this blindly with no help. Right now what I want to know is with the error handling, what is it, what's the purpose, are you speaking of trapping all of the errors into an array, and printing them ALL out at the end, or is there another purpose, thanks.
Link to comment
https://forums.phpfreaks.com/topic/11343-problems-with-mail/#findComment-42569
Share on other sites

If you are validating user input it is best to trap all errors into an array, then at the end of the validaton checks you can check whether there are any errors in the array if there are use a simple foreach loop and then display the errors in an unordered list, or in what ever format you wish to show them.

So heres what your code will basically look like:
[code]if (isset($_POST['send']))
{
    $error = ""; //setup blank error variable, this will store errors

    if (empty($_POST['name'])) {
        $error[] = 'The name field has been left blank';
    }

    if (empty($_POST['emailaddress'])) {
        $error[] = 'The Email Address field was left blank';
    }
    elseif (empty($_POST['verifyemail'])) {
        $error[] = 'The Verify Email Field was left blank';
    }
    elseif ($_POST['emailaddress'] != $_POST['verifyemail']) {
        $error[] = 'The Email Addresses do not match, please fix this';
    }

    if (empty($_POST['description'])) {
        $error[] = 'The Description Field was left blank';
    }

    //check that the error varibale is an array, if it loop through the error and displau them as an unordered list
    if(is_array($error)) {
        echo "Please correct the following errors before you continue:<br />\n<ul>";

        foreach($error as $k => $v) {
            echo '<li>' . $v . "</li>\n";
        }
        echo '</ul>';
    }
    else
    {
        //put email code here
    }
}
//form code here[/code]
Thats the best way of doing it rather than printing each error one at a time as that can pertential annoy the user. It is best to show all the errors all at once, therefore the user can work through each of the errors reported one by one.
Link to comment
https://forums.phpfreaks.com/topic/11343-problems-with-mail/#findComment-42573
Share on other sites

ok I guess I will go ahead and formulate away based on one of the ideas here, as far as today I quit on this project, I am going to my other project, tomorrow I will start trying to work it like I was shown on here, thanks for all the help I appreciate it.
Link to comment
https://forums.phpfreaks.com/topic/11343-problems-with-mail/#findComment-42574
Share on other sites

ok there is one more thing I need to ask before I even think about trying this, I thought about it, I might like doing it this way more, but what does.

[code]foreach($error as $k => $v) {[/code]

I want to avoid something that uses single letters, I understand the functionality on this all but the section that I showed, any explanation would be greatly appreciated.
Link to comment
https://forums.phpfreaks.com/topic/11343-problems-with-mail/#findComment-42584
Share on other sites

I hope you don't mind one more example...

I took your code and modified it to fit into that way I do validations. You can ignore the CSS stuff -- I was trying to make your form easier on the eyes.

[code]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Contact Us</title>
<style>
form {
    display: block;
    width: 80%;
    margin-left: auto;
    margin-right: auto;
}

form label {
    display: block;
    width: 18%;
    font-weight: bold;
    float: left;
    text-align: left;
    margin-bottom: 0.1em;
}

form input, form textarea {
    display: block;
    width: 78%;
    float: left;
    margin-bottom: 0.1em;
}

.btn {
    display: block;
    width: 100%;
    text-align: center;
    padding-top: 0.1em;
    padding-bottom: 0.1em;
    border: 1px solid red;
}

.button {
    width: auto;
    text-align: center;
    margin-left: auto;
    margin-right: auto;
}

.clearer {
    clear: both;
    line-height: 0.01em;
}
</style>
</head>
<body>
<h3>Contact Us</h3>
<p><a href="index.php" title="Return Home">Return Home</a></p>
<p>If you need to contact us for any reason you can do so below.  We will try and respond within 24 hours.</p>
<br />
<?php
$flds = array('name' => 'Name',
                  'emailaddress' => 'Email Address',
                  'verifyemail' => 'Verify Email',
                  'description' => 'Description');
if (isset($_POST['send'])){
    $errs = array();
    foreach($_POST as $k => $v)
        switch($k) {
            case 'name':
            case 'emailaddress':
            case 'verifyemail':
            case 'description':
                if (strlen(trim(stripslashes($v))) == 0)
                    $errs[] = 'The <span style="color:red;font-weight:bold">' . $flds[$k] . '</span> field was left blank';
                if ($k == 'emailaddress' && trim(stripslashes($v)) != trim(stripslashes($_POST['verifyemail'])))
                    $errs[] = 'The <span style="color:red;font-weight:bold">Email Addresses</span> do not match';
                break;
        }
    if (empty($errs)) {
        $to = "businessman332211@hotmail.com";
        $subject = "FunnyEmailForwards.com contact";
        $name = stripslashes($_POST['name']);
        $emailaddress = $_POST['emailaddress'];
        $verifyemail = $_POST['verifyemail'];
        $description = stripslashes($_POST['description']);
        $from = "FunnyEmailForwards.com Contact";
        $message = "
        Name: {$name}
        Email Address: {$emailaddress}
        Verify Email: {$verifyemail}
        What the person had to say:
        {$description}
        ";
       if (mail($to, $subject, $message, $From))
               echo 'Thank you for contacting us!<br />We will try and get back to you within 24 hours.<br />';
       else{
                echo 'There was an error sending the message, please try again!<br />';
                echo 'If it does not work the second time, please send an email directly to<br />';
                echo '<a href="mailto:businessman332211@hotmail.com">Here</a>';
                }
    }
}
if (!isset($_POST['send']) || !empty($errs)) {
    if (!empty($errs))
        echo '<hr />The following problems were found in your submitted data:<br />' . implode("<br />\n",$errs) . "<br /><hr />\n";
?>
<form name="contact" id="contact" method="post">
<label for="name">Name:</label>
<input name="name" id="name" type="text" maxlength="80" value="<?=isset($_POST['name']) ? $_POST['name'] : ''?>"/><br />
<label for="emailaddress">Email Address:</label>
<input name="emailaddress" id="emailaddress" type="text" maxlength="80" value="<?=isset($_POST['emailaddress']) ? $_POST['emailaddress'] : ''?>"/><br />
<label for="verifyemail">Verify Email Address:</label>
<input name="verifyemail" id="verifyemail" type="text" maxlength="80" value="<?=isset($_POST['verifyemail']) ? $_POST['verifyemail'] : ''?>"/><br />
<label for="description">Message:</label>
<textarea name="description" id="description" cols="20" rows="7" />
<?php
if (isset($_POST['description'])){
echo $_POST['description'];}; ?>
</textarea><br />
<div class="clearer">&amp;nbsp;</div>
<div class="btn">
<input class="button" name="send" id="send" type="submit" value="Contact Us!" />
<input class="button" name="reset" id="reset" type="reset" value="Clear Form" />
</div>
</form>
<?php } ?>
</body>
</html>[/code]

Ken
Link to comment
https://forums.phpfreaks.com/topic/11343-problems-with-mail/#findComment-42586
Share on other sites

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.