Onbekend |
|
2 bestanden:
- addwar.php (1e code, het formulier)
- addwar2.php (2e code, php stuff)
In addwar2 staat
<? if(isset($_POST['enemy'])) ?>
<? if(isset($_POST['enemy'])) ?>
alleen werkt dit niet, ook al vul je niks in het form, hij gaat door met de acties.
Wie ziet mijn fout
<table border="0" bordercolor="#000000" cellspacing="0" cellpadding="0">
<form method="post" action="addwar2.php" name="addwar">
<tr><td><font color="#666666"><b>War Toevoegen</b></font></td></tr>
<tr><td width="150">Enemy:</td><td width="250"><select size="1" name="land">
<option selected value="nl">nl</option>
<option value="be">be</option>
<option value="eu">eu</option>
<option value="uk">uk</option>
<option value="fi">fi</option>
<option value="se">se</option>
<option value="no">no</option>
<option value="de">de</option>
<option value="pl">pl</option>
</select><input type="text" name="enemy" size="27"></td></tr>
<tr><td width="150">Score:</td><td width="250">
<select size="1" name="scorestatus">
<option selected value="won">won</option>
<option value="lose">lose</option>
<option value="draw">draw</option>
</select><input type="text" name="score" size="10"></td></tr>
<tr>
<tr><td width="150">Competition</td><td width="250">
<select size="1" name="landcompetition">
<option selected value="nl">nl</option>
<option value="be">be</option>
<option value="eu">eu</option>
<option value="uk">uk</option>
<option value="fi">fi</option>
<option value="se">se</option>
<option value="no">no</option>
<option value="de">de</option>
<option value="pl">pl</option>
</select><select size="1" name="matchtype">
<option selected value="2on2">2on2</option>
<option value="3on3">3on3</option>
<option value="4on4">4on4</option>
<option value="5on5">5on5</option>
</select><select size="1" name="competition">
<option selected value="Clanbase">Clanbase</option>
<option value="Esl">Esl</option>
<option value="Cup">Cup</option>
</select><tr><td></td><td bordercolor="#FFFFFF"><input type="submit" name="verzenden" value="verzenden"></td></tr>
</form>
</table>
<table border="0" bordercolor="#000000" cellspacing="0" cellpadding="0"> <form method="post" action="addwar2.php" name="addwar"> <tr><td><font color="#666666"><b>War Toevoegen</b></font></td></tr> <tr><td width="150">Enemy:</td><td width="250"><select size="1" name="land"> <option selected value="nl">nl</option> <option value="be">be</option> <option value="eu">eu</option> <option value="uk">uk</option> <option value="fi">fi</option> <option value="se">se</option> <option value="no">no</option> <option value="de">de</option> <option value="pl">pl</option> </select><input type="text" name="enemy" size="27"></td></tr> <tr><td width="150">Score:</td><td width="250"> <select size="1" name="scorestatus"> <option selected value="won">won</option> <option value="lose">lose</option> <option value="draw">draw</option> </select><input type="text" name="score" size="10"></td></tr> <tr> <tr><td width="150">Competition</td><td width="250"> <select size="1" name="landcompetition"> <option selected value="nl">nl</option> <option value="be">be</option> <option value="eu">eu</option> <option value="uk">uk</option> <option value="fi">fi</option> <option value="se">se</option> <option value="no">no</option> <option value="de">de</option> <option value="pl">pl</option> </select><select size="1" name="matchtype"> <option selected value="2on2">2on2</option> <option value="3on3">3on3</option> <option value="4on4">4on4</option> <option value="5on5">5on5</option> </select><select size="1" name="competition"> <option selected value="Clanbase">Clanbase</option> <option value="Esl">Esl</option> <option value="Cup">Cup</option> </select><tr><td></td><td bordercolor="#FFFFFF"><input type="submit" name="verzenden" value="verzenden"></td></tr> </form> </table>
<?php
// kijken of er wel gesubmit is
if(isset($_POST['verzenden']))
{
// kijken of het vak enemy wel is ingevuld
if(isset($_POST['enemy']))
{
$land = addslashes($_POST['land']);
$enemy = addslashes($_POST['enemy']);
$scorestatus = addslashes($_POST['scorestatus']);
$score = addslashes($_POST['score']);
$matchtype = addslashes($_POST['matchtype']);
$competition = addslashes($_POST['competition']);
$landcompetition = addslashes($_POST['landcompetition']);
mysql_query("INSERT INTO wars (land, enemy, scorestatus, score, matchtype, competition, landcompetition) VALUES ('".$land."', '".$enemy."', '".$scorestatus."', '".$score."', '".$matchtype."', '".$competition."', '".$landcompetition."')") or die (mysql_error());
echo 'War succesvol toegevoegd.<br>';
echo 'Je wordt nu doorgestuurd naar de Admin pagina.';
header('refresh: 2; url=admin.php');
}
// als er geen enemy ingevuld is
else { echo 'Geen enemy ingevuld.'; }
}
// else voor als er niet gesubmit is
else { }
?>
<?php // kijken of er wel gesubmit is if(isset($_POST['verzenden'])) { // kijken of het vak enemy wel is ingevuld if(isset($_POST['enemy'])) { $landcompetition = addslashes($_POST['landcompetition']); mysql_query("INSERT INTO wars (land, enemy, scorestatus, score, matchtype, competition, landcompetition) VALUES ('".$land."', '".$enemy."', '".$scorestatus."', '".$score."', '".$matchtype."', '".$competition."', '".$landcompetition."')") or die (mysql_error()); echo 'War succesvol toegevoegd.<br>'; echo 'Je wordt nu doorgestuurd naar de Admin pagina.'; header('refresh: 2; url=admin.php'); } // als er geen enemy ingevuld is else { echo 'Geen enemy ingevuld.'; } } // else voor als er niet gesubmit is else { } ?>
|