Jump to content

[SOLVED] Quick Contact Form Question


astheria

Recommended Posts

PHP is not my forte, and I've been browsing the web looking for an answer to this question.  I'm in need of a contact form for my site and came across a free open-source file that seems to be just the ticket.  However, I'm having trouble getting it to load into my html page, and I'm not sure why.  Here is the snippet of HTML:

[code]  <h2>Contact</h2>
  <p>Voilà! In view, a humble vaudevillian veteran, cast vicariously as both victim and villain by the vicissitudes of Fate. This visage, no mere veneer of vanity, is it vestige of the vox populi, now vacant, vanished, as the once vital voice of the verisimilitude now venerates what they once vilified. However, this valorous visitation of a bygone vexation stands vivified, and has vowed to vanquish these venal and virulent vermin vanguarding vice and vouchsafing the violently vicious and voracious violation of volition. The only verdict is vengeance; a vendetta held as a votive, not in vain, for the value and veracity of such shall one day vindicate the vigilant and the virtuous. Verily, this vichyssoise of verbiage veers most verbose vis-à-vis an introduction, and so it is my very good honor to meet you and you may call me V.</p>
  <?php include("/phpincludes/contactform.php"); ?>
  </div>[/code]

And the PHP file (sorry if it's long):

[code]<?php
$nasaadresa = "astheria@gmail.com";  //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 = "
<p align='left'><br>
Thank you for your e-mail, this is confirmation that it has been received.<br>
#### MESSAGE TEXT ####
<br><br>
$poruka
<br><br>
#### END OF MESSAGE ####
<br><br>
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.<br></p>";
//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 .= "You have not filled this filed(s): <b>$dcheck[$check]</b>.<br>";
}
}
if ((!ereg(".+\@.+\..+", $Email)) || (!ereg("^[a-zA-Z0-9_@.-]+$", $Email))){
$error .= "Wrong e-mail.<br>This e-mail address <b>$Email</b> - is not valid. Please enter correct e-mail address.";
}
if($error)
{
echo $error;
echo '<br><a href="#" onClick="history.go(-1)">Please try again.</a>';
}
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 your site.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 '
<p>Feel free to get in touch with me, I am always happy to receive feedback or anything else you may have to say.</p><p>Fields marked <em>*</em> are required.</p><br /><br />
<form name="contactform" action="'.$PHP_SELF.'" method="post">
<input type="hidden" name="require" value="Name,Email,Message">
  <fieldset>
    <ul>
  <li>
    <label for="name">Name<em>*</em></label>
        <input name="Name" size="30">
      </li>
  <li>
        <label for="email">E-mail<em>*</em></label>
        <input name="Email" size="30">
  </li>
  <li>
          <label for="message">Message<em>*</em></label>
          <textarea name="Message" rows="10" cols="30"></textarea>
  </li>
  <li>
        <input type="submit" value="Send" name="submitform">
        <input type="reset" value="Reset" name="reset">
  </li>
</ul>
  </fieldset>
</form>';
}
?>[/code]
Link to comment
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.