2016-03-23 11 views
-1

じゃないと言います。戻って、フォームに正しく記入してください。 - すべてのフィールドが記入されているので、なぜそのエラーが返されているのか分かりません。余分な目が助けになるかもしれないと思いました!これは私のフルコードです:コードは、フィールドが空であるが、彼らは私が私のサイト上の別のページから取られましたが、私はそれをこの時間を使用しようとしたとき、空のフィールドが許可されていません「と、それが戻ってくるのフォームを持って

<?php 
session_start(); 
if (isset($_SESSION['USR_LOGIN'])=="") { header("Location:login.php"); 
} 
include("mytcg/settings.php"); 
include("$header"); 
if (!$_SERVER['QUERY_STRING']) { 
    $select = mysqli_query($connect, "SELECT * FROM `$table_members` WHERE email='$_SESSION[USR_LOGIN]'"); 
while($row=mysqli_fetch_assoc($select)) { ?> 
<h1>Claims</h1> 
Please take a minute to look through the decks that have already been claimed. If you do not see it on this list, you may go ahead and claim it!<br> 

    <?php 
    $username = $row['name']; 
    $select1 = mysqli_query($connect, "SELECT * FROM `donate` WHERE name='$username'"); 
    while($row=mysqli_fetch_assoc($select1)) { 
     $name1 = $row['name']; 
     $claimed1 = $row['series']; 
     echo $name1; 
     echo $claimed1; 
    } ?> 
<form action="claimdonation.php?thanks" method="post"> 
<input type="hidden" name="id" value="<?php echo $row['id']; ?>" /> 
<input type="hidden" name="name" value="<?php echo $row['name']; ?>" /> 
<input type="hidden" name="email" value="<?php echo $row['email']; ?>" /> 
<input type="hidden" name="url" value="<?php echo $row['url']; ?>" /> 
<table cellspacing="1" cellpadding="2"> 
<tr> 
<td><b>Donation Type:</b></td> 
<td><select name="type" size="1"> 
<option value="" selected="selected">- choose one -</option> 
<option value="images">Deck Images</option> 
<option value="buttons">Buttons</option> 
<option value="badges">Badge Set</option> 
<option value="stamp">Stamp Card</option> 
</select></td> 
</tr> 
<tr> 
<td><b>Name</b></td> 
<td><input type="text" name="series" size="20" /></td> 
</tr> 
<tr> 
<td><b>Category</b></td> 
<td><select name="category" size="1"> 
<option value="" selected="selected">- choose one -</option> 
<option value="na" >Not Applicable</option> 
<?php 
for ($i=1;$i<=$num_categories; $i++) { 
echo "<option value=\"$i\">".$category[$i]."</option>"; 
} 
?> 
</select></td> 
</tr> 
<tr> 
<td>&nbsp;</td> 
<td><input type="submit" name="submit" value="Claim!"> 
</tr> 
</table> 
</form> 
<?php } } elseif($_SERVER['QUERY_STRING']=="thanks") { 
if (!isset($_POST['submit']) || $_SERVER['REQUEST_METHOD'] != "POST") { exit("<p>You did not press the submit button; this page should not be accessed directly.</p>"); } 
else { 
$exploits = "/(content-type|bcc:|cc:|document.cookie|onclick|onload|javascript|alert)/i"; 
$profanity = "-- taken out for bad words --"; 
$spamwords = "--taken out for bad words--"; 
$bots = "/(Indy|Blaiz|Java|libwww-perl|Python|OutfoxBot|User-Agent|PycURL|AlphaServer)/i"; 

if (preg_match($bots, $_SERVER['HTTP_USER_AGENT'])) { 
exit("<h1>Error</h1>\nKnown spam bots are not allowed.<br /><br />"); 
} 
foreach ($_POST as $key => $value) { 
$value = trim($value); 
if (empty($value)) { 
exit("<h1>Error</h1>\nEmpty fields are not allowed. Please go back and fill in the form properly.<br /><br />"); 
} 
elseif (preg_match($exploits, $value)) { 
exit("<h1>Error</h1>\nExploits/malicious scripting attributes aren't allowed.<br /><br />"); 
} 
elseif (preg_match("#$profanity#", $value) || preg_match("#$spamwords#", $value)) { 
exit("<h1>Error</h1>\nThat kind of language is not allowed through our form.<br /><br />"); 
} 
$_POST[$key] = stripslashes(strip_tags($value)); 
} 

$id = escape_sql(CleanUp($_POST['id'])); 
$name = escape_sql(CleanUp($_POST['name'])); 
$email = escape_sql(CleanUp($_POST['email'])); 
$url = escape_sql(CleanUp($_POST['url'])); 
$type = escape_sql(CleanUp($_POST['type'])); 
$series = escape_sql(CleanUp($_POST['series'])); 
$catnum = escape_sql(CleanUp($_POST['category'])); 
$catname = "$category[$catnum]"; 

$recipient = "$tcgemail"; 
$subject = "Claim Form - $name"; 

$message = "The following member has made a claim: \n"; 
$message .= "Name: $name \n"; 
$message .= "Email: $email \n"; 
$message .= "URL: $url \n"; 
$message .= "Donation Type: $type \n"; 
$message .= "Series: $series \n"; 
$message .= "Category: $catname \n"; 

$headers = "From: $name \n"; 
$headers .= "Reply-To: <$email>"; 
echo "<h1>Thank you!</h1>"; 
echo "When you are ready to submit your donation, please do so through your member panel.<br><br>"; 
if(mail($recipient,$subject,$message,$headers)) { 
$insert = "INSERT INTO `donate` (`name`, `claimed`, `donated`) VALUES ('$name', '$series', 'No')"; 
    mysqli_query($connect, $insert); 
} 
} 
} include ("$footer"); ?> 
+0

"mytcg/settings.php"で変数のいくつかが宣言されています –

+0

コードを書式化してください –

+1

空のフィールドを確認するには 'var_dump($ _POST);'を実行してください。 – Technoh

答えて

2

中にありますが、別の中にあるので、内部では両方とも変数名 '$ row'を使用することはできません。私はこのヘルプを願っています$ ROW1

while($row=mysqli_fetch_assoc($select)) { ?> 
...... 
while($row=mysqli_fetch_assoc($select1)) { 

のように、変数名を変更し 。

+0

ありがとうございました!それはまさにそれだった! –

+2

私はこのようなフォーマットされていないコードを見ていると賞賛します。人々はコミュニティが簡単にそれを読むことができるために、適切に自分のコードをフォーマットするために、数分以上を投資することができないとき、私はこのような質問上の任意の秒を費やすことはありません... –

関連する問題

 関連する問題