Jump to content

Contact Form Issues


astheria

Recommended Posts

For some reason I'm getting all error messages showing and the email not sending even when all the information in the fields is not correct.  PHP is not something that I'm familiar with and any help would be appreciated.  Here is my php file:

[code]<?php
$nasaadresa = "[email protected]";  //please replace this with your address

$mail = $_POST['Email'];
$porukaa = $_POST['Message'];
$poruka = str_replace("\r", '<br />', $porukaa);
//START OF THANKS MESSAGE
//you may edit $thanks message. this is a message which displays when user sends mail from your site
$thanks = "
<blockquote><p>Thank you for your e-mail.</p>
<p><span>
$poruka
</span></p>
<p>You will recive a copy of the message at your email address ($mail).<br />I will do my best to respond as soon as possible.</p></blockquote>";
//do not edit nothing below this line  until comment (ME) say so if you don't have skills with PHP
//END OF THANKS MESSAGE

if($_POST['submitform'])
{

$Name = $_POST['Name'];
$Email = $_POST['Email'];
$Message = $_POST['Message'];
$require = $_POST['require'];
$browser = $HTTP_USER_AGENT;
$ip = $_SERVER['REMOTE_ADDR'];

$dcheck = explode(",",$require);
while(list($check) = each($dcheck))
{
if(!$$dcheck[$check]) {
$error .= "<span><blockquote><p>You have not filled out the following field(s): <strong>$dcheck[$check]</strong>.</p></blockquote></span>";
}
}
if ((!ereg(".+\@.+\..+", $Email)) || (!ereg("^[[email protected]]+$", $Email))){
$error .= "<span><blockquote><p>E-Mail Error.<br />This e-mail address <strong>$Email</strong> - is not valid.<br />Please enter a valid e-mail address.</p></blockquote></span>";
}
if($error)
{
echo $error;
echo '<span><blockquote><p><a href="#" onClick="history.go(-1)">Please try again.</a></p></blockqoute></span>';
}
else
{
//START OF INCOMING MESSAGE (this message goes to your inbox)
$message = "
Name: $Name:
E-mail: $Email

Message: $Message

-----------------------------
Browser: $browser
IP: $ip
";
//END OF INCOMING MESSAGE (this message goes to your inbox)

$subject = "Message from Astheria.com - Message was sent by $Name"; //subject OF YOUR INBOX MESSAGE sent to you

$subject2 = "Email to Astheria.com successful!"; //subject of OUTGOING MESSAGE - edit this
//OUTGOING MESSAGE TEXT
$message2 = "You have sent a message to Kyle Meyer of Astheria.com:
-----------------------------
From: $Name:
E-mail: $Email

Message: $Message

-----------------------------
";
//END OF outgoing MESSAGE


mail($nasaadresa,"$subject","$message","From: $Name <$Email>");
mail($Email,"$subject2","$message2","From: <$nasaadresa>");
echo "$thanks";
}
}
else{
//this is contact form down here, please edit if you know what are you doing... or the contact form may not be working.
echo '
<form class="contactform" action="'.$PHP_SELF.'" method="post">
<fieldset>
    <input type="hidden" id="require" value="Name,Email,Message" />
    <ul>
  <li>
<label for="Name">Name</label>
  </li>
  <li>
        <input class="textinput" id="Name" size="50" />
          </li>
  <li>
        <label for="Email">E-mail</label>
  </li>
          <li>
        <input class="textinput" id="Email" size="50" />
  </li>
  <li>
        <label for="Message">Message</label>
  </li>
  <li>
        <textarea id="Message" rows="10" cols="50"></textarea>
  </li>
  <li>
        <input class="button" type="submit" value="Send" name="submitform" />
        <input class="button" type="reset" value="Reset" name="reset" />
  </li>
</ul>
  </fieldset>
</form>';
}
?>[/code]
Link to comment
https://forums.phpfreaks.com/topic/33610-contact-form-issues/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.