SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast
    Join Date
    Feb 2006
    Location
    Bel Air, Maryland.
    Posts
    60
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    form submit to new window, PHP doesn't recognize POST data

    Hey guys,

    I have a comparison application that when a user selects multiple items then clicks "Compare" and a new window pops up with a side by side comparison.

    The items all have their own checkbox with IDs, contained inside a Form. When the compare button is clicked the Form sends the item IDs in POST to a compare.php page.

    My conditional at the top of "compare.php" if(isset($_POST('Submit')) does not seems to work in Internet Explorer, and the page dies. HOWEVER, in Firefox it goes through fine to pass the IDs and display the info correctly.

    So does anyone know why IE and PHP won't recognize the form POST data if it's launched in a new window??

    Hope that makes sense. Thanks!!
    ---
    Paul S. Smith
    technetic | design & code

  2. #2
    . shoooo... silver trophy logic_earth's Avatar
    Join Date
    Oct 2005
    Location
    CA
    Posts
    9,013
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)
    Did you click the submit button or did you press enter? Check for a required field not the submit button.
    Logic without the fatal effects.
    All code snippets are licensed under WTFPL.


  3. #3
    SitePoint Wizard bronze trophy
    Join Date
    Jul 2008
    Posts
    5,757
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    IE has bugs with certain form controls(or other browsers do, and IE is correct depending on how you look at it).

    It's rare that you actually need to check for the submit button anyway unless you actually need the value, or the name of the clicked button. Unless your form has more than one button, you simply don't need to check it. I know you probably saw it every single snippit of php code you've come across, but its generally very senseless.

    Instead, concern yourself with checking for the data you actually need.

    You can see what the browser actually sent by doing print_r($_POST);

  4. #4
    SitePoint Enthusiast
    Join Date
    Feb 2006
    Location
    Bel Air, Maryland.
    Posts
    60
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks guys!

    It turns out that IE wasn't recognizing the button with name="Submit" or something along the lines. I changed if(isset($_POST('Submit')) TO if(isset($_POST)) just to see if there was POST data at all before it executes, and now it works. Strange.
    ---
    Paul S. Smith
    technetic | design & code


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
  •