Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 5 of 5

Thread: testing post

  1. #1
    Senior Member ceetee's Avatar
    Join Date
    Jul 2003
    Posts
    117
    Member #
    2035
    Now I think this really is php Occasionally when I submit a form by POST to update a database, some of the fields erroneously end up with null values. Presumabley this is because something in the POST operation malfunctioned.

    I could test every single POST variable to prevent the database corruption. But is possible to test the POST operation as a whole?

  2.  

  3. #2
    Senior Member filburt1's Avatar
    Join Date
    Jul 2002
    Location
    Maryland, US
    Posts
    11,774
    Member #
    3
    Liked
    21 times
    There is no way to check perfectly, but your software should already be validating what the user sent.

    I've never heard of POST values just missing. Make sure that your HTML is correct and you're not relying on register_globals.
    filburt1, Web Design Forums.net founder
    Site of the Month contest: submit your site or vote for the winner!

  4. #3
    Senior Member ceetee's Avatar
    Join Date
    Jul 2003
    Posts
    117
    Member #
    2035
    Yes I was relying on register_globals. Are you saying that variables using register_globals have a problem that might explain the data disappearing?

  5. #4
    Senior Member Brak's Avatar
    Join Date
    Apr 2003
    Location
    San Francisco, CA
    Posts
    3,413
    Member #
    1217
    Liked
    2 times
    Always use the $_POST, $_GET, $_COOKIE, and $_SESSION superglobals. You cant est the POST as a whole using a foreach (it's just an array)

    foreach($_POST as $key=>$value) do something;
    Kyle Neath: Rockstar extraordinare
    The blog | The poetry site | The Spore site

  6. #5
    Senior Member nsr81's Avatar
    Join Date
    Oct 2002
    Posts
    1,132
    Member #
    250
    Liked
    15 times
    try what Brak said.

    I quite often use the following to check what exactly is being POSTed.

    PHP Code:
    foreach($_POST as $key=>$value
    {
        print(
    "<b>$key</b>: $value <br>");

    Keep in mind that variable names are case-sensitive in php, so a form field name "Email" is not stored in $email after you submit but in $Email. (with register_global on).
    There and Back Again :Ogre:


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 12:31 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com