Formularz
<?php
require('config.php');
$char='0';
} else {
$char = $_GET['c'];
}
$subtype = "Utwórz";
$subhead = "Wpisz dane postaci i kliknij przycisk " .
"'$subtype postać.'";
$tablebg = '#EEEEFF';
$sql = "SELECT id, power FROM char_power";
$pwrlist[$row['id']] = $row['power'];
}
}
$sql = "SELECT id, alias FROM char_main WHERE id != $char";
$charlist[$row['id']] = $row['alias'];
}
if ($char != '0') {
$sql = "SELECT c.alias, c.real_name AS name, c.align, " .
"l.lair_addr AS address, z.city, z.state, z.id AS zip " .
"FROM char_main c, char_lair l, char_zipcode z " .
"WHERE z.id = l.zip_id " .
"AND c.lair_id = l.id " .
"AND c.id = $char";
$subtype = "Uaktualnij";
$tablebg = '#EEFFEE';
$subhead = "Dokonaj edycji danych dla <i>" . $ch['alias'] .
"</i> i kliknij przycisk '$subtype postać.'";
$sql = "SELECT p.id " .
"FROM char_main c " .
"JOIN char_power p " .
"JOIN char_power_link pk " .
"ON c.id = pk.char_id " .
"AND p.id = pk.power_id " .
"WHERE c.id = $char";
$powers[$row['id']] = 'selected';
}
}
// pobierz listę wrogów postaci
$sql = "SELECT n.id " .
"FROM char_main c " .
"JOIN char_good_bad_link gb " .
"JOIN char_main n " .
"ON (c.id = gb.good_id AND n.id = gb.bad_id) " .
"OR (n.id = gb.good_id AND c.id = gb.bad_id) " .
"WHERE c.id = $char";
$enemies[$row['id']] = 'selected';
}
}
}
}
?>
<html>
<head>
<title>Edycja postaci</title>
</head>
<body>
<img src="CBA_Tiny.gif" align="left" hspace="10">
<h1>Witryna postaci<br />komiksowych</h1><br />
<h3>
<?php echo $subhead; ?></h3>
<form action="char_transact.php" name="theform" method="post">
<table border="0" cellpadding="15" bgcolor="
<?php echo $tablebg; ?>">
<tr>
<td>Pseudonim postaci:</td>
<td><input type="text" name="alias" size="41"
value="
<?php if (isset($ch)) { echo $ch['alias']; } ?>">
</td>
</tr>
<tr>
<td>Rzeczywiste imię i nazwisko:</td>
<td><input type="text" name="name" size="41"
value="
<?php if (isset($ch)) { echo $ch['name']; } ?>">
</td>
</tr>
<tr>
<td>Moce:<br><font size="2" color="#990000">
(Ctrl+klikniecie, aby<br>zaznaczyć wiele<br>mocy)</font>
</td>
<td>
<select multiple name="powers[]" size="4">
<?php
foreach ($pwrlist as $key => $value) {
echo "<option value=\"$key\" "; }
echo ">$value</option>\n"; }
?>
</select>
</td>
</tr>
<tr>
<td>Lokalizacja kryjówki:<br><font size="2" color="#990000">
(adres,<br>miasto, województwo, kod pocztowy)</font>
</td>
<td><input type="text" name="address" size="41"
value="
<?php if (isset($ch)) { echo $ch['address']; } ?>"><br>
<input type="text" name="city"
value="
<?php if (isset($ch)) { echo $ch['city']; } ?>">
<input type="text" name="state" size="2"
value="
<?php if (isset($ch)) { echo $ch['state']; } ?>">
<input type="text" name="zip" size="10"
value="
<?php if (isset($ch)) { echo $ch['zip']; } ?>">
</td>
</tr>
<tr>
<td>Charakter:</td>
<td>
<input type="radio" name="align" value="dobry"
echo($ch['align']=='dobry' ?
' checked' : ''); } ?>>
dobry<br>
<input type="radio" name="align" value="zły"
echo($ch['align']=='zły' ?
' checked' : ''); } ?>>
zły
</td>
</tr>
<tr>
<td>Wrogowie:<br><font size="2" color="#990000">
(Ctrl+kliknięcie, aby<br>zaznaczyć wielu<br>wrogów)</font>
</td>
<td>
<select multiple name="enemies[]" size="4">
<?php
foreach ($charlist as $key => $value) {
echo "<option value=\"$key\" "; }
echo ">$value</option>\n"; }
?>
</select>
</td>
</tr>
<?php } ?>
<tr>
<td colspan="2">
<input type="submit" name="action"
value="
<?php echo $subtype; ?> postać">
<input type="reset">
<?php if ($subtype == "Uaktualnij") { ?>
<input type="submit" name="action" value="Usuń postać">
<?php } ?>
</td>
</tr>
</table>
<input type="hidden" name="cid" value="
<?php echo $char; ?>">
</form>
<a href="charlist.php">Powróć do strony głównej</a>
</body>
</html>