Results 1 to 2 of 2

Thread: PHP Form Submission

  1. #1
    Join Date
    Jan 2008
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default PHP Form Submission

    I've got a validation page in place on all administrative pages of a site and is running perfectly. I'm trying to duplicate it for a different site and server location.

    Now I've duplicated the database structure and pulled over the code from the working site and now I've hit a problem that's got me stumped.

    When I go to validate the authorized users of the site my submission form doesn't do anything. I don't get the expected error message or a successful message to view the pages.

    Any help is greatly appreciated. Here's the code for the validation page that just won't submit.

    Thanks.
    PHP Code:
    <?php
    session_start
    ();
    session_register("sess_var");
    ?>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <head>
    <title>Admin Login</title>

    </head>
    <body bgcolor="#003399">

    <?
    // includes
    include("conf.php");
    include(
    "functions.php");
    ?>

    <?php
    if (!$HTTPS && $REQUEST_METHOD=="POST") { 
    # Open a connection 
    $connection mysql_connect($host$user$pass) or die ("Unable to connect!");

    // select database
    mysql_select_db($db) or die ("Unable to select database!");

    $sql "SELECT id FROM admin_users WHERE name='$name' and password='$password'";

    $result mysql_query($sql)
        or die(
    "Couldn't execute query.");

    $num mysql_numrows($result);

    if (
    $num 1) {
        
    $sess_var "Authorized User!";
        echo 
    "<p align=\"center\"><font color=ffffff>You have been authorized!</font></p>";
        echo 
    "<p align=\"center\"><A HREF=\"index.php\"><font color=ffffff>Click here to continue.</font></A></span></p>";
    }
    else {
        echo 
    "<p align=\"center\"><font color=ffffff>You are <b>NOT</b> authorized to use this site or you have entered incorrect information for your username and password!</span></font></p>";
        echo 
    "<p align=\"center\"><A HREF=\"validate.php\"><font color=ffffff>Click here to try again.</font></A></p>";
    }
    }
    else {
    ?>

      <form action="validate.php" method="post">
      <table align="center" border="0" cellpadding="5" cellspacing="0" class="text">

        <tr bgcolor="#CCCCCC"> 
          <td><strong>Username:</strong></td>
          <td> 
            <input type="text" name="name" size="15">
          </td>
        </tr>
        <tr bgcolor="#CCCCCC"> 
          <td><strong>Password:</strong></td>
          <td> 
            <input type="password" name="password" size="15">
          </td>
        </tr>
        <tr bgcolor="#CCCCCC"> 
          <td colspan="2" align="center"> 
            <input type="submit" value="Submit Information">
          </td>
        </tr>
      </table>
    </form>
    <?php
    }
    ?>

    </body>
    </html>
    Edit: Wrapped code in [php][/php] tags.
    Last edited by tech_support; 01-28-2008 at 01:57 AM.

  2. #2
    Join Date
    Jun 2007
    Posts
    543
    Thanks
    3
    Thanked 78 Times in 78 Posts
    Blog Entries
    1

    Default

    wrap your code in [code ] tags or [php ] tags (without the spaces). also you may want to show the other included files. try changing this:
    Code:
    <?
    // includes
    include("conf.php");
    include("functions.php");
    ?>
    with this:
    Code:
    <?php
    // includes
    include("conf.php");
    include("functions.php");
    ?>
    [Jasme Library (Javascript Motion Effects)] My Site
    /\/\@ /\/\@|{
    There are 10 kinds of people in the world, those that understand binary and those that don't.

Bookmarks

Posting Permissions

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