Hmm, Jeg har nu fået hele scriptet fra min veninde og det er meget længere og skulle gerne komme herfra:
<?php require_once('../common.php'); ?>
<?php
$link = dbConnect();
$query_modtager = "SELECT * FROM nyhedsbrev";
$modtager = mysql_query($query_modtager, $link) or die(mysql_error());
$row_modtager = mysql_fetch_assoc($modtager);
$totalRows_modtager = mysql_num_rows($modtager);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"
http://www.w3.org/TR/html4/loose.dtd"><html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>:: Nyhedsbrev Administration ::</title>
<style type="text/css">
<!--
.style7 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; color: #000000; }
.style9 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 11px;
color: #009933;
font-weight: bold;
}
-->
</style>
</head>
<body>
<form name="form1" method="post" action="index.php">
<table width="56%" border="0" cellspacing="3" cellpadding="3">
<tr>
<td height="37" colspan="3"><p class="style9">Send Nyhedsbrev</p>
</td>
</tr>
<tr>
<td width="12%" class="style7">Subject:</td>
<td colspan="2"><input name="mailSubject" type="text" id="mailSubject" size="30"></td>
</tr>
<tr>
<td class="style7">Tekst:</td>
<td colspan="2"><textarea name="mailBody" cols="77" rows="15" id="mailBody"></textarea></td>
</tr>
<tr>
<td class="style9"> </td>
<td width="66%"> </td>
<td width="22%" align="right"><input name="action" type="submit" id="action" value="Send Email"></td>
</tr>
</table>
</form>
<table width="100%" border="0" cellspacing="2" cellpadding="2">
<tr class="style9">
<td width="16%">navn</td>
<td width="19%">e-mail</td>
<td width="24%">adresse</td>
<td width="21%">tlf</td>
<td width="20%">Slet</td>
</tr>
<tr>
<td colspan="5"><?php do { ?>
<table width="91%" border="1" cellpadding="3" cellspacing="0" bordercolor="#E6E6FF">
<tr>
<td width="17%" height="22" class="style7"><?php echo $row_modtager['name']; ?></td>
<td width="21%" class="style7"><?php echo $row_modtager['email']; ?></td>
<td width="27%" class="style7"><?php echo $row_modtager['adresse']; ?></td>
<td width="23%" class="style7"><?php echo $row_modtager['tlf']; ?></td>
<td width="12%" class="style7"><a href="delete.php?id=<?php echo $row_modtager ['id']; ?>"><strong>Slet</strong></a></td>
</tr>
<?php // Create a readable joined date out of timestamp
$joined = strftime("%D", $joined);?>
</table>
<?php } while ($row_modtager = mysql_fetch_assoc($modtager)); ?></td>
</tr>
</table>
<br>
</body>
</html>
<?
// Decide on what action we need to take
switch($action) {
// Fetch list of subscribers
case "List modtagere":
fetchList();
break;
// Send email to subscribers
case "Send Email":
sendEmail($mailSubject, $mailBody);
break;
default:
print "Slet modtager eller send nyhedsbrev.";
exit;
}
function sendEmail ($mailSubject, $mailBody) {
// Register global variables
// global $modtager;
foreach ($row_modtager['email'] AS $en_modtagers_email ){
// Set up reply address for mailing list
$mailFrom = "Nyhedsbrev <redaktion@vaerk.dk>";
// Ensure that subject and body of email have automatically inserted escape slashes removed
$mailSubject = stripslashes($mailSubject);
$mailBody = stripslashes($mailBody);
// Build to address including subscriber name
$mailTo = $en_modtagers_email;
// Send email to
mail($mailTo, $mailSubject, $mailBody, "From: " . $mailFrom);
}
}
print "Nyhedsbrev er blevet udsendt..";
?>
<?php
mysql_free_result($modtager);
?>
Jeg kan ikke helt selv forstå hendes opsætning, men hun har lavet det i dreamveawer som jeg ikke selv bruger til kode da jeg synes det er forvirrende.