SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Guru johnjohn2's Avatar
    Join Date
    Apr 2004
    Location
    here
    Posts
    746
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    problem with url parameter that equals NULL value

    I have a list of url parameters that get passed from one form on a page to another "update" form on another page in order to check for duplicates before the record is saved. I'm having a problem with the list boxes. The ones that are submitted with no value are sent as Null. But I get this error:

    ERROR: invalid input syntax for integer: ""

    For example, using the GET function my url may look like this on the page the info is submitted to:

    www.example.com/33.php?col1=333&col37=&col38=345

    col37 is the one I'm having problems with. It's an integer field in a postgresql database, and it's allowed to contain NULL values.

    The second page/form receives the info in a hidden field using:

    <?php if (isset($_GET['col37'])){echo $_GET['col37'];} else {echo Null;} ?>

    Is "isset" not the correct code to use, since "col37" is a url parameter but there's just no value? Or is there something else I can try?

  2. #2
    SitePoint Enthusiast Zeldinha's Avatar
    Join Date
    Sep 2004
    Location
    Barcelona [Spain]
    Posts
    89
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try with empty(). I usually check both, just in case


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
  •