Valikorlia_Code
12-30-2006, 01:42 AM
Well, I might as well start of with the codes and such.
This is the form (index.php)
<?php
if (!isset($_POST['submit'])) {
?>
<form action="" method="post">
Valikorlia Username: <input type="text" name="username"><br><br>
Type of Approval: <select name="type">
<option value="magic">Magic</option>
<option value="weapon">Weapon/Artifact</option>
<option value="race">Race</option>
<option value="guild">Guild/Faction</option>
<option value="other">Other</option>
</select><br><br>
Approval Content (be descriptive): <textarea name="content" cols=40 rows=20></textarea><br><br>
<input type="submit" name="submit" value="Submit!">
</form>
<?php
} else {
$username = $_POST['username'];
$type = $_POST['type'];
$content = $_POST['content'];
mysql_query("INSERT INTO `pending` (username, type, content) VALUES ('$username', '$type', '$content')");
echo "Your approval has been sent to the RPAs! Please allow the RPAs to look over your request. To see your request's status, please click <a href=status.php>here</a> ";
}
?>
This is the file that displays the data inside the database (status.php)
<?php
$sql = "SELECT * FROM pending";
$query = mysql_query($sql);
while($row = mysql_fetch_array($query)) {
echo "<tr>";
echo "<td>".$row['username']."</td>";
echo "<td>".$row['type']."</td>";
echo "<td>".$row['content']."</td>";
echo "</tr>";
}
?>
And this is how my database is set up:
CREATE TABLE `pending` (
`username` varchar(255) NOT NULL,
`type` varchar(255) NOT NULL,
`content` longtext NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
What's happening is that the "type" and "content" variables are being inserted in to the database, but the "username" field is not.
This is the form (index.php)
<?php
if (!isset($_POST['submit'])) {
?>
<form action="" method="post">
Valikorlia Username: <input type="text" name="username"><br><br>
Type of Approval: <select name="type">
<option value="magic">Magic</option>
<option value="weapon">Weapon/Artifact</option>
<option value="race">Race</option>
<option value="guild">Guild/Faction</option>
<option value="other">Other</option>
</select><br><br>
Approval Content (be descriptive): <textarea name="content" cols=40 rows=20></textarea><br><br>
<input type="submit" name="submit" value="Submit!">
</form>
<?php
} else {
$username = $_POST['username'];
$type = $_POST['type'];
$content = $_POST['content'];
mysql_query("INSERT INTO `pending` (username, type, content) VALUES ('$username', '$type', '$content')");
echo "Your approval has been sent to the RPAs! Please allow the RPAs to look over your request. To see your request's status, please click <a href=status.php>here</a> ";
}
?>
This is the file that displays the data inside the database (status.php)
<?php
$sql = "SELECT * FROM pending";
$query = mysql_query($sql);
while($row = mysql_fetch_array($query)) {
echo "<tr>";
echo "<td>".$row['username']."</td>";
echo "<td>".$row['type']."</td>";
echo "<td>".$row['content']."</td>";
echo "</tr>";
}
?>
And this is how my database is set up:
CREATE TABLE `pending` (
`username` varchar(255) NOT NULL,
`type` varchar(255) NOT NULL,
`content` longtext NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
What's happening is that the "type" and "content" variables are being inserted in to the database, but the "username" field is not.
