[SOLVED] [HELP] Undefined index
Posted: Wed Dec 15, 2004 5:46 pm
heres my whole code... i dont know whats wrong..
I get this error:
line 65 =
can someone tell me whats wrong 
Code: Select all
<?php
error_reporting(E_ALL);
$valid = array('email');
$email = empty($_GET['email']) ? 'email' : $_GET['email'];
if(in_array($email, $valid)){
mysql_connect ("localhost", "steve_maillist", "maillist") or die(mysql_error());
mysql_select_db ('steve_maillist') or die(mysql_error());
$sql = 'SELECT * FROM maillist ORDER BY '.$email;
$result = mysql_query($sql) or die(mysql_error());
} else {
echo 'Invalid email: '.$_GET['email'];
}
echo "<table width="100%" border="1" cellspacing="0" cellpadding="0">";
echo "<tr>";
echo "<td width="25%"><span class="style4">EMAIL</span></td>\n";
echo "</tr>";
while ($data = mysql_fetch_assoc($result)) {
echo "<tr>";
echo "<td><span class="style1">";
echo '<a href="mailto:'.$data["email"].'"> '.$data["email"].'</a>';
echo " <a href='maillist.php?del=dl&id=" . $data["email"] . "'>*Delete*</a> ";
echo "</span></td>";
echo "</tr>";
echo mysql_error();
}
echo "</table><BR>";
?>
<?PHP
if ($_GET['del'] == 'dl') {
$connect = mysql_connect ("localhost", "steve_maillist", "maillist") or die ('I cannot connect to the database because: ' . mysql_error());
$db = mysql_select_db ("steve_maillist");
$num = $_GET['email'];
$query = mysql_query("DELETE FROM maillist WHERE email = '$num'");
echo "<br>All Done, No ERRORS!!<BR><BR>";
}
?>
<b><a href="#" onclick="return hidetoggle('msgs');" onmouseover="window.status=' past messages '; return true;">PAST EMAILS SENT</a></b>(click to view the drop down)<br>
<span id="msgs" class="leftborder" style="display: none;">
<?php
error_reporting(E_ALL);
$dbh=mysql_connect ("localhost", "steve_maillist", "maillist") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("steve_maillist", $dbh);
$sql = "SELECT * FROM messages";
echo mysql_error();
$result = mysql_query($sql, $dbh);
echo mysql_error();
echo "<table width="100%" border="1" cellpadding="0" cellspacing="0">";
echo "<tr>";
echo "<td width="8%"><span class="style4">ID</span> </td>";
echo "<td width="23%"><span class="style4">Message</span></td>";
echo "</tr>";
while ($data = mysql_fetch_assoc($result)) {
echo "<tr>";
echo "<td width="8%"><span class="style1">";
echo $data["id"];
echo "</span></td>";
echo "<td width="23%"><span class="style1">";
echo $data["msg"];
echo "</span> </td>";
echo "</tr>";
echo mysql_error();
}
echo "</table>";
?>
</span><br><BR>
<B>Send Mass Mail</b>:
<?PHP
if (!empty($_POST['submitted']) && $_POST["submitted"] == 1){
error_reporting(E_ALL);
$subject = $_POST["subject"];
$body = $_POST["body"];
$from = $_POST["from"];
$dbh=mysql_connect ("localhost", "steve_maillist", "maillist") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("steve_maillist");
$sql = "SELECT * FROM messages";
mysql_query("INSERT INTO `messages` (`id`, `msg`)VALUES ('', '$body')");
$result = mysql_query($sql, $dbh) or die (mysql_error());
$query = mysql_query("SELECT * FROM maillist");
while ($result = mysql_fetch_array($query)) {
mail($result['email'],$subject,$body,
"FROM: {$from}\r\n");
}
echo mysql_error();
echo "Mail Sent!!<Br>";
echo "Message stored!";
}
else
{
echo "<form method="POST" action="" . $_SERVER['PHP_SELF'] . "">\n";
echo ("<table border="0" cellspacing="0" cellpadding="0">");
echo ("<tr>");
echo ("<td valign="top"><span class="style4">reply emai</span>l</td>");
echo ("<td><span class="style1"><input type="text" name="from" size="33"></span></td>");
echo ("</tr>");
echo ("<td valign="top"><span class="style4">subject</span></td>");
echo ("<td><span class="style1"><input type="text" name="subject" size="33" maxlength="50" /></span></td>");
echo ("</tr>");
echo ("<tr>");
echo ("<td valign="top"><span class="style4">body</span> </td>");
echo ("<td><span class="style1"><textarea name="body" rows="9" cols="52"></textarea></span></td>");
echo ("</tr>");
echo ("<tr>");
echo ("<td colspan="2">");
echo ("<input type="hidden" name="submitted" value="1">");
echo ("<input type="image" name=submitted src="imgs/submit.jpg" value="1"></center></form>");
echo ("</td>");
echo ("</tr>");
echo ("</form><BR>");
}
echo mysql_error();
?>Code: Select all
Notice: Undefined index: del in /home/steve/public_html/onepurpose/maillist/maillist.php on line 65Code: Select all
if ($_GET['del'] == 'dl') {