Dali mi neko moze reci kako da "doteram' izgled skripte u PHP-u, odnosno kako ovu skriptu napravim da izgleda lepse kada se otvori. <html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Email anyone</title>
</head>
<body>
<p><font size="5"><b>Email</b></font></p>
<?php
if(@isset($_POST['submit'])) {
// require fields...look at the hidden field to change what's required
$required_fields = explode(",", $_POST['required']);
$error = 0;
foreach($required_fields as $fieldname) {
if ($_POST[$fieldname] == "") {
$error++;
}
}
if ($error == 0) {
if (strstr($_POST['to'], "@") and strstr($_POST['to'], ".")) {
if (strstr($_POST['from'], "@") and strstr($_POST['from'], ".")) {
// headers to be included in email
$headers .= "MIME-Version: 1.0\n";
// html header (delete the following row if you do not want html to show)
$headers .= "Content-type: text/html; charset=iso-8859-1\n";
// from header
$headers .= "From: $_POST[name] <$_POST[from]>";
// mail function
mail("$_POST[to]" , "$_POST[subject]", $_POST[message], $headers);
// success message
// if you receive a php error, make sure your server is set up to send email
print "<b><font size=2>Your email has been sent to $_POST[to] from $_POST[from]</font></b>";
exit;
}
} else {
$errormessage = "<b><font color=red>The email address you entered does not appear to be valid.</font><br></b>";
}
} else {
$errormessage = "<b><font color=red>You have left some required fields in the form blank. Please fill in the form completely.</font><br></b>";
}
}
?>
<form action="<? PHP_SELF; ?>" method="POST">
<? echo "$errormessage"; ?>
<p><font color="#FF0000">Everything is required. </font></p>
<p><font color="#000000">To: </font>
<font color="#000000">
<input name="to" type="text" id="to" size="30">
</font></p>
<p><font color="#000000">From (email): </font>
<font color="#000000">
<input name="from" type="text" id="from" size="30">
</font></p>
<p><font color="#000000">From (name):
<input name="name" type="text" id="name" size="30">
</font></p>
<p><font color="#000000">Subject
<input name="subject" type="text" id="subject" size="30">
</font></p>
<p><font color="#000000">Message <br>
HTML code is turned on.
<br>
<textarea name="message" cols="40" rows="6" id="message"></textarea>
</font></p>
<p>
<font color="#000000">
<input type="submit" value="Submit" name="submit">
</font> </p>
<input type="hidden" name="required" value="to,from,name,subject,message">
</form>
</body>
</html> Hvala svima.
|