何らかの理由で、ID以外からデータベースに何も送信されていません
HTML
<form action="sendmessage.php" method="post">
<input name="youremail" type="text" class="your-field" id="youremail" value="Your Email Address" size="35" />
<input name="name" type="text" class="their-field" id="name" value="Receivers Name" size="35" onclick="if(this.value == 'Receivers Name') { this.value = ''; }" />
<input name="receiveremail" type="text" class="their-field" id="receiveremail" value="Receivers Email Address" size="35" onclick="if(this.value == 'Receivers Email Address') { this.value = ''; }" />
<textarea name="message" cols="35" rows="5" class="valentine-message" id="textarea" onclick="if(this.value == 'Your Message') { this.value = ''; }" />Your Message</textarea>
<input class="button" name="" type="image" src="images/button.jpg" onClick="submit')">
</form>
PHP
// creates a random number for the id, ans check to see if the random number currently exists in database
$success = FALSE;
while($success == FALSE) {
$rand = rand(100000, 999999);
$q = "SELECT * FROM $tablename WHERE rand = '$rand'";
$r = mysql_query($q, $link);
echo mysql_error();
if(mysql_num_rows($r)) { //id exists
continue;
} else {
$success = TRUE;
}
}
// insert your data here with $rand as the id
$query = "INSERT into $tablename values ('$rand', '$youremail', '$name', '$receiveremail', '$message')";
$result = mysql_query($query, $link);
if (!$result) {
echo "Query Failed: " . mysql_error() . "<br />\n";
exit;
}
これがデータベース構造ですhttp://i50.tinypic.com/14jq3he.pngそれに関する問題を見ることができますか?