Turvenn.no
Webutvikler kurs ASP.NET, C#, CSS mm.

WebRessurs.no - Webprogrammering og ressurs innen ASP, ASP.NET, PHP, SQL, HTML, CSS, Javascript, XML, C#, VB, Flash  mm.

Brukernavn: 
Passord:

Registrèr deg Glemt passord?
Logg deg inn




  ASP.net (199)
  ASP 3.0 (111)
  PHP (30)
  HTML (66)
  SQL (89)
  CSS (46)
  XML (7)
  JavaScript (78)
  Diverse kode (13)


  Programmering (22)
  System og drift (15)
  Trafikk og inntekt (11)
  Guider og tips (22)
  Nyttig lesestoff (23)
  Web forum (604)
  Link galleri (565)


  ASP.NET kurs(5)
  CSS kurs (2)
  JQuery kurs (2)


  Øk trafikken (8)
  Facebook App. (4)
  Microsoft CEO (6)


  Server & web
  Internett & epost
  Systemverktøy
  Sikkerhet
  Fildeling
  Lyd & media
  Diverse software


  Domenesalg
  Metagenerator
  Websikre farger
  WebMail


  Bli medlem!
  Siste innlegg
  Gjestebok
  Tips en venn
  Kontakt oss
  Forsiden




Kode Artikler
Linker


Mål internetthastigheten din.


Php-kode for å sende meldinger ( avansert ) html & heading

av halles
 
Send the message using mail() function
Header:
'MIME-Version: 1.0' . "\r\n";
'Content-type: text/html; charset=iso-8859-1' . "\r\n";

<?php
/* Set e-mail recipient */
$myemail = "ender denne til din epost adresse";

/* Check all form inputs using check_input function */
$yourname = check_input($_POST['yourname'], "Enter your name");
$subject = check_input($_POST['subject'], "Write a subject");
$email = check_input($_POST['email']);
$website = check_input($_POST['website']);
$likeit = check_input($_POST['likeit']);
$how_find = check_input($_POST['how']);
$comments = check_input($_POST['comments'], "Write your comments");

/* If e-mail is not valid show error message */
if (!preg_match("/([\w\-]+\@[\w\-]+\.[\w\-]+)/", $email))
{
show_error("Ikke en gyldig epost-adresse");
}

/* If URL is not valid set $website to empty */
if (!preg_match("/^(https?:\/\/+[\w\-]+\.[\w\-]+)/i", $website))
{
$website = '';
}

/* Let's prepare the message for the e-mail */
$message = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>

<body>
<p>&nbsp;</p>
<table width="31%" border="1" cellspacing="0" cellpadding="0">
<tr>
<td><strong>Hello!

Kontaktsjema send av:</strong></td>
</tr>
</table>
<p>Name: $yourname
<br />
E-mail: $email
<br />
<br />
URL: $website

<br />
<br />
Liker du hjemmesida mi? $likeit
<br />
Hvordan fant du/dere siden? $how_find

<br />
Kommentar:
$comments

<br />
<br />
<br />
Slutten av meldingen </p>
<p>Mvh</p>
<p><a href="http://www.halleswebdesign.com">Halles Webdesign</a></p>
</body>
</html>
';

/* Send the message using mail() function */
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

mail($myemail, $subject, $message, $headers);
/* Redirect visitor to the thank you page */
header('Location: index.php');
exit();

/* Functions we used */
function check_input($data, $problem='')
{
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
if ($problem && strlen($data) == 0)
{
show_error($problem);
}
return $data;
}

function show_error($myError)
{
?>
<html><title>mail skjema</title>
<body>

<b>Please correct the following error:</b><br />
<?php echo $myError; ?>

</body>
</html>
<?php
exit();
}
?>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<!-- DW6 -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Kontaktsjema</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body,td,th {
color: #FFFFFF;
}
body {
background-color: #7d1e02;
}
a:link {
color: #FFFFFF;
}
a:visited {
color: #FFFFFF;
}
a:hover {
color: #FFFFFF;
}
a:active {
color: #FFFFFF;
}
-->
</style></head>

<html>
<body>

<p>Felter i <b>FET</b> skrift er nødvendige.</p>

<form action="mail.php" method="post">
<p><b>Navnet ditt:</b> <input type="text" name="yourname" /><br />
<b>Emne:</b> <input type="text" name="subject" /><br />
<b>E-mail:</b> <input type="text" name="email" /><br />
Webside: <input type="text" name="website"></p>

<p>Liker du hjemmesida mi?
<input type="radio" name="likeit" value="Ja" checked="checked" /> Ja
<input type="radio" name="likeit" value="Nei" /> Nei
<input type="radio" name="likeit" value="Ikke sikker" /> Ikke sikker</p>

<p>Hvordan fant du oss?
<select name="how">
<option value=""> -- Vennligst velg -- </option>
<option>Google</option>
<option>Yahoo</option>
<option>Link</option>
<option>Tips fra andre</option>
<option>Annet</option>
</select>

<p><b>Dine kommentarer:</b><br />
<textarea name="comments" rows="10" cols="40"></textarea></p>

<p><input type="submit" value="Send inn!"></p>

</form>

</body>
</html>

WebRessurs.no anbefaler:    StackOverflow.com | Experts-Exchange.com | W3schools | ASP.NET | Codeproject | 4Guys
WebRessurs.no er utviklet og drives av SoftMaker
Sett som startside: [ ]. Bokmerk denne siden: [ klikk ]. Sitemap. http://twitter.com/webressurs_no/. Antall brukersesjoner: 14105970.
Copyright WebRessurs.no © 2003 - 2018
Jobbsøk.no - Jobbsøknad, CV, intervju, tips og lenker