CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8

Thread: [RESOLVED] Problem with Registration Form

  1. #1
    Join Date
    Jun 2007
    Location
    .NET 3.5 Beta SP1, Visual Basic 2008 Express
    Posts
    225

    [RESOLVED] Problem with Registration Form

    Okay, So I have an HTML form like this.

    Code:
    <HTML>
    <HEAD>
    <title>Simple reg Test</title>
    </HEAD>
    <BODY>
    <h1>Register below!</h1>
    <p/>
    <p/>
    <form action="registration.php" method="POST">
    Name: <input type="text" name="UNAME" />
    EMail: <input type="text" name="EMail" />
    Choose your character type:
    <select name="CType">
      <option value="Warrior">Warrior</option>
      <option value="Mage">Mage</option>
      <option value="Rogue">Rogue</option>
    </select>
    If you were referred to this game, input their name below:
    <input type="text" name="Ref" />
    <input type="submit" />
    </form>
    </BODY>
    </HTML>
    Then I have that script, the registration.php one.

    Code:
    <? php
    
    $link = mssql_connect  ('DCL','TMS','TMSMonkey');
    
    if( !$link )
    {
    
       echo 'Something went wrong with SQL Server Connection.';
       
    }
    else
    {
    
       echo 'We\'d be registering someone right now with these credentials.';
       echo $_GET["UNAME"];
       echo $_GET["EMail"];
       echo $_GET["CType"];
       echo $_GET["Ref"];
       
    }
    
    mssql_close($link)
    ?>
    My problem is this. Neither POST or GET will display the variables right. When I try to echo something like this:

    Code:
    echo '<p>' . $_GET["UNAME"] . '</p>'
    I get

    Code:
    $_GET["UNAME"].
    </p>
    as output. When I just try the individual POST and GET's they give me a blank page. Yet, as seen in the URL being sent, the values are there. What's up with this?

    Code:
    file:///D:/Server/Webhome/testing%20grounds/registration.php?UNAME=Coop&EMail=X%40aol.com&CType=Warrior&Ref=Alzan
    Microsoft Visual Basic 2008 Express Edition
    .NET Framwork 3.5 Beta SP1

  2. #2
    Join Date
    Apr 2005
    Location
    India
    Posts
    271

    Re: Problem with Registration Form

    Dear ccubed,

    Looking at the link you have posted at the bottom - file:///D:/Server/Webhome/testing%20grounds/registration.php?UNAME=Coop&EMail=X%40aol.com&CType=Warrior&Ref=Alzan - it seems you are not trying to run your PHP code within a webserver environment. Please check that.

    Pramod S Nair
    Learn by Sharing.

    You can use some free things i have done from www.wisdombay.com

  3. #3
    Join Date
    Jun 2007
    Location
    .NET 3.5 Beta SP1, Visual Basic 2008 Express
    Posts
    225

    Re: Problem with Registration Form

    Even when done in an HTTP environment it doesn't work.

    Code:
    http://dcl/registration.php?UNAME=Coop&EMail=X&#37;40aol.com&CType=Warrior&Ref=Alzan
    Not sure if it matters, but i'm using the latest PHP on Windows IIS 7.
    Microsoft Visual Basic 2008 Express Edition
    .NET Framwork 3.5 Beta SP1

  4. #4
    PeejAvery's Avatar
    PeejAvery is offline Super Moderator Power Poster
    Join Date
    May 2002
    Posts
    10,943

    Re: Problem with Registration Form

    It sounds as though you don't have PHP installed right. Have you gotten other PHP code to work? You can test your PHP installation by using <?php phpinfo(); ?>.

    Or, if your installation is working properly, you can try using print_r($_POST); to assess the variables being passed.

    And a little advice...When working with sensitive information, you should use POST and not GET. That way, other machines won't be able to sniff what that information is.
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  5. #5
    Join Date
    Jun 2007
    Location
    .NET 3.5 Beta SP1, Visual Basic 2008 Express
    Posts
    225

    Re: Problem with Registration Form

    Quote Originally Posted by PeejAvery View Post
    It sounds as though you don't have PHP installed right. Have you gotten other PHP code to work? You can test your PHP installation by using <?php phpinfo(); ?>.

    Or, if your installation is working properly, you can try using print_r($_POST); to assess the variables being passed.

    And a little advice...When working with sensitive information, you should use POST and not GET. That way, other machines won't be able to sniff what that information is.
    The basic phpinfo function works fine, I can post the output from that if you want. Also, I completely plan on using POST, but at the moment GET allows me to debug for this problem easier because I can see that information is being passed. I also tried that print_r($_POST) and a print_r($_GET). Both of them resulted in a blank page.
    Microsoft Visual Basic 2008 Express Edition
    .NET Framwork 3.5 Beta SP1

  6. #6
    PeejAvery's Avatar
    PeejAvery is offline Super Moderator Power Poster
    Join Date
    May 2002
    Posts
    10,943

    Re: Problem with Registration Form

    Is the following in your source code for the registration.php page just a typo? There should be no space there.

    PHP Code:
    <? php
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  7. #7
    Join Date
    Jun 2007
    Location
    .NET 3.5 Beta SP1, Visual Basic 2008 Express
    Posts
    225

    Re: Problem with Registration Form

    Quote Originally Posted by PeejAvery View Post
    Is the following in your source code for the registration.php page just a typo? There should be no space there.

    PHP Code:
    <? php

    Oh, yeah, it's a typo. However, even changing that doesn't fix the problem.
    Microsoft Visual Basic 2008 Express Edition
    .NET Framwork 3.5 Beta SP1

  8. #8
    Join Date
    Jun 2007
    Location
    .NET 3.5 Beta SP1, Visual Basic 2008 Express
    Posts
    225

    Re: Problem with Registration Form

    Problem solved. Apparently, There's a difference in how information is sent via URLs in a web environment and just the files. After changing the <?php thing and putting it in my webserver to test it works. Thanks for you help.
    Microsoft Visual Basic 2008 Express Edition
    .NET Framwork 3.5 Beta SP1

Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)