Im needing my php code to show on a diffrent form all the records that are in the database on one page, I have coded the Add record now how would i get it to show all the records that have been added. I have added the code for Add Record and the Process and also the config.php code below can anyone helpe me please.?
Add.php
Config.phpPHP Code:<html>
<head>
<title>IP BAN</title>
<link rel="stylesheet" type="text/css" href="style.css">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<form method="post" action="process.php">
<td align="center" valign="top">
<?php if(isset($_GET["ip"]) == "sent") { echo "<font color=\"red\">Ip has been added to band list, thank you.</font>"; } else {}?>
<br>
<table width="40%" border="0" align="center" cellpadding="2" cellspacing="2" bordercolor="#000000">
<tr align="left" valign="top">
<td width="20%"> IP:</td>
<td width="80%"> <input name="ip" type="text" id="ip"></td>
</tr>
<tr align="left" valign="top">
<td>Reason:</td>
<td> <textarea name="Reason" cols="25" rows="4" id="Reason"></textarea></td>
</tr>
<tr align="left" valign="top">
<td> </td>
<td> <input type="submit" name="Submit" value="Submit to server">
</td>
</tr>
</table> </td>
</tr>
</table>
<div align="center"><br>
<font size="-2">*Please do not abuse the request box. Your IP will be logged
for security purposes. </font></div>
</form>
</body>
</html>
Process.phpPHP Code:<?
// Please edit the variables below:
//Set the MySQL server address (usually localhost)
$host = "localhost";
//Enter the login name you wish to access your database with
$username = "**********";
//Enter the password to access the database
$password = "*********";
//Enter the database you wish to use
$db = "*********";
?>
All works fine above just need help to show all the added ip address's on another page?PHP Code:<?php
$ip = $_POST["ip"];
$Reason = $_POST["Reason"];
if($ip == "" OR $Reason == ""){
echo "Your name or message was blank! Please go back and fix this";
die();
} else {}
include("config.php");
mysql_connect("$host", "$username", "$password");
mysql_select_db($db) or die(mysql_error());
mysql_query("INSERT INTO `ip` ( `ip` , `Reason` ) VALUES ( '$ip' , '$Reason')")
or die ("Could not insert into database.");
header("Location: add.php?ip=sent");
?>


Reply With Quote

