topical media & game development
basic-php-10-charedit.php / php
<?php
require('config.php');
if (!isset(_GET['c'] == '' || !is_numeric(char='0';
} else {
_GET['c'];
}
subhead = "Please enter character data and click " .
"'tablebg = '#EEEEFF';
conn);
result = mysql_query(result) > 0) {
while (result)) {
row['id']] = sql = "SELECT id, alias FROM char_main WHERE id != result = mysql_query(result) > 0) {
result);
row['id']] = char != '0') {
char";
sql)
or die(mysql_error());
result);
if (is_array(subtype = "Update";
subhead = "Edit data for <i>" . subtype Character.'";
char";
sql)
or die(mysql_error());
if (mysql_num_rows(row = mysql_fetch_array(powers[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 = result = mysql_query(result) > 0) {
while (result)) {
row['id']] = 'selected';
}
}
}
}
?>
<html>
<head>
<title>Character Editor</title>
</head>
<body>
<img src="CBA_Tiny.gif" align="left" hspace="10">
<h1>Comic Book<br />Appreciation</h1><br />
<h3><?php echo tablebg; ?>">
<tr>
<td>Character Name:</td>
<td><input type="text" name="alias" size="41"
value="<?php if (isset(ch['alias']; } ?>">
</td>
</tr>
<tr>
<td>Real Name:</td>
<td><input type="text" name="name" size="41"
value="<?php if (isset(ch['name']; } ?>">
</td>
</tr>
<tr>
<td>Powers:<br><font size="2" color="#990000">
(Ctrl-click to<br>select multiple<br>powers)</font>
</td>
<td>
<select multiple name="powers[]" size="4">
<?php
foreach (key => key\" ";
if (isset(key,powers[value</option>\n";
}
?>
</select>
</td>
</tr>
<tr>
<td>Lair Location:<br><font size="2" color="#990000">
(address,<br>city, state, zip)</font>
</td>
<td><input type="text" name="address" size="41"
value="<?php if (isset(ch['address']; } ?>"><br>
<input type="text" name="city"
value="<?php if (isset(ch['city']; } ?>">
<input type="text" name="state" size="2"
value="<?php if (isset(ch['state']; } ?>">
<input type="text" name="zip" size="10"
value="<?php if (isset(ch['zip']; } ?>">
</td>
</tr>
<tr>
<td>Alignment:</td>
<td>
<input type="radio" name="align" value="good"
<?php if (isset(ch['align']=='good' ? ' checked' : '');
} ?>>
good<br>
<input type="radio" name="align" value="evil"
<?php if (isset(ch['align']=='evil' ? ' checked' : '');
} ?>>
evil
</td>
</tr>
<?php if (isset(charlist)) { ?>
<tr>
<td>Enemies:<br><font size="2" color="#990000">
(Ctrl-click to<br>select multiple<br>enemies)</font>
</td>
<td>
<select multiple name="enemies[]" size="4">
<?php
foreach (key => key\" ";
if (isset(enemies[value</option>\n";
}
?>
</select>
</td>
</tr>
<?php } ?>
<tr>
<td colspan="2">
<input type="submit" name="action"
value="<?php echo subtype == "Update") { ?>
<input type="submit" name="action" value="Delete Character">
<?php } ?>
</td>
</tr>
</table>
<input type="hidden" name="cid" value="<?php echo
(C) Æliens
20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.