Jump to content

Recommended Posts

Here are my two scripts I have checked them lots but still can't figure it out:

 

Here's the first 1 for people to enter their info on:

<form action="test.php" method="post">

          <table width="444" border="0" cellspacing="2" cellpadding="0">

            <tr>

              <td width="41%" class="bodytext">Your name:</td>

              <td width="59%"><p>

                <input name="name" type="text" id="name" size="32" />

                  </p></td>

                </tr>

            <tr>

              <td class="bodytext">Email address:</td>

              <td><p>

                <input name="email" type="text" id="email" size="32" />

                  </p></td>

                </tr>

            <tr>

              <td width="41%" class="bodytext">Age:</td>

              <td width="59%"><p>

                <input name="age" type="text" id="name" size="32" />

                  </p></td>

                </tr>

<tr>

              <td width="41%" class="bodytext">Xfire:</td>

              <td width="59%"><p>

                <input name="xfire" type="text" id="name" size="32" />

                  </p></td>

                </tr>

<tr>

              <td width="41%" class="bodytext">Will you follow the rules?</td>

              <td width="59%"><p>

                <input name="rules" type="text" id="name" size="32" />

                  </p></td>

                </tr>

<tr>

              <td width="41%" class="bodytext">Can you host a dedicated server?</td>

              <td width="59%"><p>

                <input name="host" type="text" id="name" size="32" />

                  </p></td>

                </tr>

<tr>

              <td width="41%" class="bodytext">Will you donate? If so how much?</td>

              <td width="59%"><p>

                <input name="donate" type="text" id="name" size="32" />

                  </p></td>

                </tr>

<tr>

              <td width="41%" class="bodytext">Reason why you want to join:</td>

              <td width="59%"><p>

                <input name="reason" type="text" id="name" size="32" />

                  </p></td>

                </tr>

              <td class="bodytext"> </td>

              <td align="left" valign="top"><input type="submit" name="Submit" value="Send" /></td>

                </tr>

              </table>

            </form>

 

And here's the test.php (method):

 

<?php

if ($_POST["email"]<>'') {

$ToEmail = 'mtb_dj_4_life@live.com';

$EmailSubject = 'POH Clan Apply Form ';

$mailheader = "Name: ".$_POST["email"]."\r\n";

$mailheader .= "Reply-To: ".$_POST["email"]."\r\n";

$mailheader .= "Content-type: text/html; charset=iso-8859-1\r\n";

$MESSAGE_BODY = "Name: ".$_POST["name"]."<br>";

$MESSAGE_BODY .= "Email: ".$_POST["email"]."<br>";

$MESSAGE_BODY .= "Age:".nl2br($_POST["age"])."<br>";

$MESSAGE_BODY .= "Xfire:".nl2br($_POST["xfire"])."<br>";

$MESSAGE_BODY .= "Follow the rules?:".nl2br($_POST["rules"])."<br>";

$MESSAGE_BODY .= "Host:".nl2br($_POST["host"])."<br>";

$MESSAGE_BODY .= "Donate:".nl2br($_POST["donate"])."<br>";

$MESSAGE_BODY .= "Reason to join:".nl2br($_POST["reason"])."<br>";

mail($ToEmail, $EmailSubject, $MESSAGE_BODY, $mailheader) or die ("Failure");

?>

        MESSAGE

        <?php

} else {

?>

        <form action="test.php" method="post">

          <table width="444" border="0" cellspacing="2" cellpadding="0">

            <tr>

              <td width="41%" class="bodytext">Your name:</td>

              <td width="59%"><p>

                <input name="name" type="text" id="name" size="32" />

                  </p></td>

                </tr>

            <tr>

              <td class="bodytext">Email address:</td>

              <td><p>

                <input name="email" type="text" id="email" size="32" />

                  </p></td>

                </tr>

            <tr>

              <td width="41%" class="bodytext">Age:</td>

              <td width="59%"><p>

                <input name="age" type="text" id="name" size="32" />

                  </p></td>

                </tr>

<tr>

              <td width="41%" class="bodytext">Xfire:</td>

              <td width="59%"><p>

                <input name="xfire" type="text" id="name" size="32" />

                  </p></td>

                </tr>

<tr>

              <td width="41%" class="bodytext">Will you follow the rules?</td>

              <td width="59%"><p>

                <input name="rules" type="text" id="name" size="32" />

                  </p></td>

                </tr>

<tr>

              <td width="41%" class="bodytext">Can you host a dedicated server?</td>

              <td width="59%"><p>

                <input name="host" type="text" id="name" size="32" />

                  </p></td>

                </tr>

<tr>

              <td width="41%" class="bodytext">Will you donate? If so how much?</td>

              <td width="59%"><p>

                <input name="donate" type="text" id="name" size="32" />

                  </p></td>

                </tr>

<tr>

              <td width="41%" class="bodytext">Reason why you want to join:</td>

              <td width="59%"><p>

                <input name="reason" type="text" id="name" size="32" />

                  </p></td>

                </tr>

              <td class="bodytext"> </td>

              <td align="left" valign="top"><input type="submit" name="Submit" value="Send" /></td>

                </tr>

              </table>

            </form>

        <?php

};

?>

 

Thanks HEAPS!

 

Link to comment
https://forums.phpfreaks.com/topic/176489-php-error-failure/
Share on other sites

Unless you bother to state exactly what problem you are having and what you see in front of you when you try your code, no one can directly help you.

 

We are not standing next to you. If you aren't, can't, or won't provide relevant information in your post, you cannot get a relevant reply. For all we know, you don't have php installed on your web server.

Link to comment
https://forums.phpfreaks.com/topic/176489-php-error-failure/#findComment-930340
Share on other sites

 

try this bro?

 

<?php

if (isset($_POST['submit']) && (isset($_POST['email']))) {
   $ToEmail = 'mtb_dj_4_life@live.com';
   $EmailSubject = 'POH Clan Apply Form ';
   $mailheader = "Name: ".$_POST["email"]."\r\n";
   $mailheader .= "Reply-To: ".$_POST["email"]."\r\n";
   $mailheader .= "Content-type: text/html; charset=iso-8859-1\r\n";
   $MESSAGE_BODY = "Name: ".$_POST["name"]."<br>";
   $MESSAGE_BODY .= "Email: ".$_POST["email"]."<br>";
   $MESSAGE_BODY .= "Age:".nl2br($_POST["age"])."<br>";
   $MESSAGE_BODY .= "Xfire:".nl2br($_POST["xfire"])."<br>";
   $MESSAGE_BODY .= "Follow the rules?:".nl2br($_POST["rules"])."<br>";
   $MESSAGE_BODY .= "Host:".nl2br($_POST["host"])."<br>";
   $MESSAGE_BODY .= "Donate:".nl2br($_POST["donate"])."<br>";
   $MESSAGE_BODY .= "Reason to join:".nl2br($_POST["reason"])."<br>";
   mail($ToEmail, $EmailSubject, $MESSAGE_BODY, $mailheader) or die ("Failure");

}
   ?>

Link to comment
https://forums.phpfreaks.com/topic/176489-php-error-failure/#findComment-930398
Share on other sites

 

try this bro?

 

<?php

if (isset($_POST['submit']) && (isset($_POST['email']))) {
   $ToEmail = 'mtb_dj_4_life@live.com';
   $EmailSubject = 'POH Clan Apply Form ';
   $mailheader = "Name: ".$_POST["email"]."\r\n";
   $mailheader .= "Reply-To: ".$_POST["email"]."\r\n";
   $mailheader .= "Content-type: text/html; charset=iso-8859-1\r\n";
   $MESSAGE_BODY = "Name: ".$_POST["name"]."<br>";
   $MESSAGE_BODY .= "Email: ".$_POST["email"]."<br>";
   $MESSAGE_BODY .= "Age:".nl2br($_POST["age"])."<br>";
   $MESSAGE_BODY .= "Xfire:".nl2br($_POST["xfire"])."<br>";
   $MESSAGE_BODY .= "Follow the rules?:".nl2br($_POST["rules"])."<br>";
   $MESSAGE_BODY .= "Host:".nl2br($_POST["host"])."<br>";
   $MESSAGE_BODY .= "Donate:".nl2br($_POST["donate"])."<br>";
   $MESSAGE_BODY .= "Reason to join:".nl2br($_POST["reason"])."<br>";
   mail($ToEmail, $EmailSubject, $MESSAGE_BODY, $mailheader) or die ("Failure");

}
   ?>

I don't get a failure but no email gets sent.

Link to comment
https://forums.phpfreaks.com/topic/176489-php-error-failure/#findComment-931777
Share on other sites

That's because $_POST['submit'] does not match what your form sends, so that was a waste of your time.

 

If the two lines of code that I posted and you added did not result in any error messages from the mail() function, then your mail server has likely been configured to operate 'silently' and not return error messages. This is generally being done to prevent hackers from feeding invalid information to a mail server in order to triggers errors that then gives them information about the mail server.

 

You are using a Name: field in the headers. To the best of my knowalge, there is no such SMTP field and you are not using a From: field. It is likely one or both of these things is causing the mail() function to fail.

 

You should be using a From: field with an email address in it that is hosted at the sending mail server. The Reply-to: address should be the email that the visitor entered, which is what you have now. There should be no Name: field.

Link to comment
https://forums.phpfreaks.com/topic/176489-php-error-failure/#findComment-931789
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.