Jump to content

Tutorial Scripting - Formular De Contact


xhakon
 Share

Recommended Posts

Aveti nevoie de 2 fisiere:
-contact.html
-mail.php

IIn contact.html adaugati:

<form name="link site" action="mail.php" method="post"> 
<tr> 
<td colspan="2"> 
Nume:&nbsp;&nbsp;&nbsp;<input type="text" name="nume" size="39"><font color="#FF0000">*</font></td><br> 
</tr> 
<tr> 
<td colspan="2"> 
Email:&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="email" size="39"><font color="#FF0000">*</td></font><br> 
</tr> 
<tr> 
<td colspan="2"> 
Mesaj:&nbsp;&nbsp;&nbsp;<textarea rows="10" name="mesaj" cols="30"></textarea><font color="#FF0000">*<br> 
</tr> 
<tr> 
<td><input type="submit" value="Trimite Cererea" name="trimite"></td> 
</tr> 
</form>

Iar in mail.php adaugati:

<?php 
$email = 'aici emailul tau'; 
$subiect = 'Subiect'; 

$nume = $_POST['nume']; 
$mail = $_POST['email']; 
$mesaj = $_POST['mesaj']; 

if($nume=="") exit("Va rugam specificati numele dumneavoastra."); 
if($mail=="") exit("Va rugam specificati un email pe care doriti sa va contactam."); 
if($mesaj="") exit("Va rugam scrieti un mesaj"); 

$continut = 'Nume: $nume \nMail: $mail \nMesaj: $mesaj'; 


mail($email, $subiect, $continut); 
echo "Emailul a fost trimis. <a href='index.php'>INAPOI</a>"; 
?>

* Trebuie sa ai functia mail() activa pe host pentru a putea trimite mail-ul, altfel nu va trimite nimic. !!!!!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...