Fejlbeskeder ved parsing af email-formular
Jeg er ved at kode en email-formular, der indeholder følgende snippet.$id = $_GET['id'];
if (isset($_GET['id'])) {
$customeremail = @mysql_query(
"SELECT name, email FROM customer WHERE id='$id'"
);
}
// get the first (and hopefully only) entry from the result
$row = mysql_fetch_array($customeremail);
// Print out the contents of each row into a table
$email = $row['email'];
$name = $row['name'];
echo $row['email'];
?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<p>Send email:</p>
<label>Name: <input type="text" name="name"
value="<?php echo $name; ?>" /></label><br />
<label>Email: <input type="text" name="email_from_form"
value="<?php echo $email; ?>" /></label><br />
<label>Subject: <input type="text" name="subject" /></label><br />
<input type="hidden" name="id" value="<?php echo $id; ?>" />
<textarea name="email_message" rows="15" cols="45">
</textarea>
<input type="submit" value="SUBMIT" /></p>
</form>
<p><a href="customers.php">New search</a></p>
PHP fetcher data'en fra MySQL-databasen uden problemer, men jeg får følgende fejlbeskeder:
Notice: Undefined variable: customeremail in /Applications/MAMP/htdocs/easypark_test/emailcustomer.php on line 69
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /Applications/MAMP/htdocs/easypark_test/emailcustomer.php on line 69
Min email-formular fungerer fint, men jeg vil gerne vide hvad det er der får PHP til at spytte fejlbesker ud.