Gå til innhold

Hva er feil med dette ...


Anbefalte innlegg

Videoannonse
Annonse

Ok .. egentlig lastet jeg ned koden fra free-php.net da men ...

 

Jeg har absolutt ingen erfaring med php men her er config.inc:

 

<?

# script directory # no trailing slash
$script_dir = "C:\Mine dokumenter\klan side\design5\test\ContactForm\inc\mail.php";

# script url (url to script directory above)
# no trailing slash
$script_url = "http://home.no.net/regrry/mail.php";

# variables below corresponds to the Email to * in your contact form
# match the numbers to the value for which option maps to a specific email
# you can add more as long as you keep them in sync

$adminemail[1] = "[email protected]";
$adminemail[2] = "[email protected]";
$adminemail[3] = "[email protected]";

# preceeds the subject the user puts in on the contact form
$subjectheader = "[Contact Form]:";

# url the form will redirect to after sending email
$redirecturl = "http://home.no.net/regrry/contact.php";

# text that will display if you leave above variable blank
$finishedtext = "Thank you We will Reply asap!";

# how the message will show in the email
# you can reorder these how you wish or modify the message itself to your liking
# just be sure and leave the $variables in tact

$msg2 = "
   Name: $name
   Email: $email
   Company: $company
   Phone: $phone
   Website: $website
   Message:$msg
";
?>

 

Her er mail.php

 

<script LANGUAGE="JavaScript">
   <!-- Hide code from non-js browsers
   function validate()
   {
       formObj = document.contact;
       if ((formObj.name.value == "") ||
           (formObj.email.value  == "") ||
           (formObj.subject.value  == "") ||
           (formObj.msg.value  == ""))
       {
           alert("You have not filled in all required fields.");
           return false;
       }
       else
           return true;
   }
   // end hiding -->
</SCRIPT>

<TABLE BORDER=0 cellpadding=5 cellspacing=0>
 <TR>
   <TD>
      <TABLE BORDER=0 cellpadding=2 cellspacing=0>
        <form action="<? echo $script_url; ?>/contact.php" method="post" name="contact" onSubmit="return validate()">
        <TR>
          <TD>
               <BR>
               <DIV>
               1. Name *<BR>
               <input type=text value='your name' size=50 maxlength=50 name=name class='txtfield'><BR>

               2. Email Adress *<BR>
               <input type='text' value='[email protected]' size='50' maxlength='60' name='email'><BR>

               
             
               3. Webiste<BR>
               <input type='text' value='http://www.yoursite.com' size='50' maxlength='60' name='website'><BR>

               4. Email to *<BR>
               <select name='who'>
               <option value='1'>LaffeLord</option>
               <option value='2'>Webmaster</option>
               <option value='3'>Information</option>
               </select><BR>

               5. Subject *<BR>
               <input type='text' value='' size='50' maxlength='60' name='subject'><BR>

               6. Message *<BR>
               <textarea name='msg' rows='7' cols='50'></textarea><BR>

               </DIV>

               <input type='submit' value='submit'>* Field Required<BR>

         </TD>
       </tR>
       </FORM>
     </tABLE>
   </TD>
 </TR>
</tABLE>

 

Og her er header.php

 

<HTML>
<HEAD>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Contact Form</title>
<META name="description" content="">
<META name="keywords" content="">
<META name="revisit-after" content="7days">
<META name="robots" content="index, follow">

</HEAD>
<BODY BGCOLOR=#FFFFFF LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0 rightmargin=0>

 

Her er contact.php

 

<html>
<p>We will respond asap !</p>

</html>

 

Hmm enda en contact.php .... ps. denne contact filen lå i en annen mappe:

 

<?

   include('inc/config.inc');
include($script_dir . 'header.php');

if ($_SERVER['REQUEST_METHOD'] == "POST") {

   mail("$adminemail[$who]", "$subjectheader $subject", "$msg2", "From: $email \nReply-To: $email");

      if ($redirecturl != "") {
         header("Location: $redirecturl");
      } else {
         echo "<br><center>$finishedtext</center><br>";
      }

} else {

   include($script_dir . 'mail.php');

}

include($script_dir . 'footer.php');

?>

 

Håper dette hjalp ...

Lenke til kommentar


# script directory # no trailing slash
$script_dir = "C:\Mine dokumenter\klan side\design5\test\ContactForm\inc\mail.php";

Her skal det vel stå path'en til script directory på serveren?

 

Men hva er det som ikke virker? Lettere å hjepe hvis du sier hva som skjer/ikke skjer.

Lenke til kommentar

Opprett en konto eller logg inn for å kommentere

Du må være et medlem for å kunne skrive en kommentar

Opprett konto

Det er enkelt å melde seg inn for å starte en ny konto!

Start en konto

Logg inn

Har du allerede en konto? Logg inn her.

Logg inn nå
  • Hvem er aktive   0 medlemmer

    • Ingen innloggede medlemmer aktive
×
×
  • Opprett ny...