出于某种原因,除了 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你能看到任何问题吗?