Okay, here's what I'm trying to accomplish...
I'm trying to create a contact database.
View.php allows a user to view contacts within the database and the information we have for each thus far. Each contact has an "Edit/Update" option. When the Edit/Update option is selected, it passes an id variable to edit.php. (http://www.xyz.com/edit.php?id=1)
Now, I can get the correct information displayed for the contact in edit.php, but when I try to fill in form fields on this page and update the information, or try to send an email to the contact , I get an "Undefined index: id" and "Undefined variable: id" error.
Here's the code in edit.php:
[FONT=courier new]
<?php
require_once ('includes/config.inc');
require_once ('includes/header.html');
require_once ('../../../files/mysql_connect.php');
$SERVER['QUERY_STRING'];
$REQUEST['id'];
$idn = $id;
$query = "SELECT * FROM mytable WHERE id=$idn";
$result=mysql_query ($query);
while ($row = mysql_fetch_array ($result, MYSQL_ASSOC)) {
echo "<table cellpadding=\"5\" cellspacing=\"5\"><tr>";
echo "<tr><td>Contact Email:</td><td>{$row['contact']}</td></tr>";
echo "<tr><td>Request Sent?</td><td>{$row['reqsent']}</td>";
}
if (isset($_POST['send'])) {
$contact = ($row['contact']);
$body = "Some text";
mail ($contact,'Subject?', $body, 'From:me@memememe.com');
echo '<p>Email Sent</p>';
$query = "UPDATE mytable SET date=NOW() WHERE id=('$idn')";
$result = @mysql_query ($query);
exit();
}
?>
[/FONT][/COLOR]
Can anyone help me out? Oh, and if you can explain it to me as if I knew nothing about PHP, that'd be great. (Although I'm not a total newbie, I've barely crossed the line into non-newbie territory).
Thanks!