Results 1 to 2 of 2

Thread: php help please

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jul 2004
    Posts
    1,202

    php help please

    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

    PHP 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>&nbsp;</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>
    Config.php
    PHP 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 = "*********";

    ?>
    Process.php
    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");

    ?>
    All works fine above just need help to show all the added ip address's on another page?
    Last edited by RobDog888; Oct 15th, 2008 at 02:30 AM.
    come back and mark your original post as resoved if your problem is fixed

    Jamie Garland

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: php help please

    I removed the sensitive information in your post
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width