Kontakt strana za sajt ?

Evo ja imam neki html kod ali i treba php deo koji neznam da napravim... Evo primera html koda :

<table width="98%" border="0" cellspacing="0" cellpadding="3">
<tr>
<td colspan="2">
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="4"><b>Kontakt</b></font>
</td>
</tr>
<tr>
<td><img src="images/transparent.gif" width="155" height="4"></td>
<td><img src="images/transparent.gif" width="155" height="4"></td>
</tr>
<tr>
<td colspan="2"><font face="Verdana, Arial, Helvetica, sans-serif" size="2"></form></td>
</tr>
<form action="contact.php" method="post">
<tr>
<td valign="top"><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Ime
i prezime</font></td>
<td> <font face="Verdana, Arial, Helvetica, sans-serif" size="2">
<input type="text" name="ime" size="35" maxlength="40" value="">
<b><font color="#FF0000">*</font></b></font></td>
</tr>
<tr>
<td valign="top"><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Firma</font></td>
<td> <font face="Verdana, Arial, Helvetica, sans-serif" size="2">
<input type="text" name="firma" size="35" maxlength="40" value="">
</font></td>
</tr>
<tr>
<td valign="top"><font face="Verdana, Arial, Helvetica, sans-serif" size="2">e-mail</font></td>
<td> <font face="Verdana, Arial, Helvetica, sans-serif" size="2">
<input type="text" name="email" maxlength="20" size="20" value="">
<b><font color="#FF0000">*</font></b></font></td>
</tr>
<tr>
<td valign="top"><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Tekst</font></td>
<td valign="top"> <font face="Verdana, Arial, Helvetica, sans-serif" size="2">
<textarea name="tekst" cols="40" rows="8"></textarea>
<b><font color="#FF0000">*</font></b></font></td>
</tr>
<tr align="left">
<td colspan="2"><font face="Verdana, Arial, Helvetica, sans-serif" size="2">
<b><font color="#FF0000">*</font></b></font><font face="Verdana, Arial, Helvetica, sans-serif" size="1">
Obavezno popuniti</font></td>
</tr>
<tr align="center">
<td colspan="2"> <font face="Verdana, Arial, Helvetica, sans-serif" size="2">
<input type="submit" name="submit" value="Posalji">
</font></td>
</tr>
<tr align="center">
<td colspan="2">&nbsp;</td>
</tr>
</form>

E sada mi treba contact.php ! Ako neko moze da mi napravi bicu mu jako zahvalan...
 
Ako ti se svidja ova kontakt forma :

http://www.netmajstor.com/kontakt.html

Skripta se sastoji iz Style foldera i kontak stranice,evo koda za kontak.php(ili html samo promenis extenziju fajla) :

<?php

// Define your email address - where to send messages - here
define("MAIL_TARGET","ovde stavis adresu na kojoj hoces da ti stize mejl");

// Here you can redefine error messages
define("errorName","Invalid name! It must be at least 2 characters long");
define("errorEmail","Invalid email address!");
define("errorMsg","Invalid message! It must be at least 10 characters long");

function createForm($name="",$email="",$message="",$error1="",$error2="",$error3=""){
?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<table>
<tr><td>Ime i prezime: </td><td class="error"><?php echo $error1; ?></td></tr>
<tr><td colspan="2"><input class="text" type="text" name="name" value="<?php echo $name; ?>"></td></tr>
<tr><td>Email:</td><td class="error"><?php echo $error2; ?></td></tr>
<tr><td colspan="2"><input class="text" type="text" name="email" value="<?php echo $email; ?>"></td></tr>
<tr><td>Poruka:</td><td class="error"><?php echo $error3; ?></td></tr>
<tr><td colspan="2"><textarea cols="40" rows="6" name="message"><?php echo $message; ?></textarea></td></tr>
<tr><td colspan="2"><br/><input class="text" type="submit" name="submitBtn" value="Posalji"></td></tr>
</table>
</form>
<?php
}

function isValidEmail($email){
$pattern = "^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$";

if (eregi($pattern, $email)){
return true;
}
else {
return false;
}
}

function sendMail($name,$email,$message){

$subject = "Message from website";
$from = "From: $name <$email>\r\nReply-To: $email\r\n";
$header = "MIME-Version: 1.0\r\n"."Content-type: text/html; charset=iso-8859-1\r\n";
$content = htmlspecialchars($message);

$content = wordwrap($content,70);
mail(MAIL_TARGET,$subject,$content,$from.$header);

}
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Micro Contact Form</title>
<link href="style/style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="main">
<div id="caption">Kontakt</div>
<div id="icon">&nbsp;</div>
<?php if (!isset($_POST['submitBtn'])) {
createForm();
} else {
$name = isset($_POST['name']) ? $_POST['name'] : "";
$email = isset($_POST['email']) ? $_POST['email'] : "";
$message = isset($_POST['message']) ? $_POST['message'] : "";

$error = false;

if (strlen($name)<2) {
$error = true;
$error1 = errorName;
}
if (!isValidEmail($email)) {
$error = true;
$error2 = errorEmail;
}
if (strlen($message)<10) {
$error = true;
$error3 = errorMsg;
}

if ($error){
createForm($name,$email,$message,$error1,$error2,$error3);
}
else {
sendMail($name,$email,$message);
?>

<div id="result">
<table width="100%">
<tr><td>
Thanks for your message!
</td></tr>
</table>
</div>
<?php
}
}
?>
<div>
<!-- footer -->
<center>
<br /><br />
<div class='form_copyr'>
Povratak na : <a href="http://www.netmajstor.com">NETMAJSTOR</a>
</div>
<p>&nbsp;</p>
</center>
</body>

I ostaje samo da uplodujes style na tvoj server :

http://www.*************/?2yc9fitjx4g

Ako ne znas sam da odradis ovo javi se preko privatnih poruka !
 

Back
Top