HTML form Array is not working in PHP

Discussion in 'PHP' started by RichestGirl, Sep 8, 2009.

  1. #1
    Dear Friend,

    Please help..

    I have very serious issue in HTML form array.

    I want to use Code as follows
    <input type="text" name="myname[]">
    <input type="text" name="myname[]">
    <input type="text" name="myname[]">
    Code (markup):
    array of Text elements in HTML and need to be handled in PHP.
    To retrieve values via following PHP code
    <?php
    	print "<pre>";
    	print_r($_POST);
    	print "</pre>";
    ?>
    PHP:
    but this works on one sever but not on other
    Go Here http://www.shantiwebsolution.com/test.php
    Give some input and submit. You will see PHP output
    BUT
    https://66.223.111.17:8443/sitepreview/http/together-ware.com/test.php
    Give some input and submit. You will not see out put.

    Please Advise if any configuration setting are required to be edited.

    I have posted complete Code below for above sample urls.

    
    <?php
    	print "<pre>";
    	print_r($_POST);
    	print "</pre>";
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Untitled Document</title>
    </head>
    
    <body>
    <form id="form1" name="form1" method="post" action="">
      <input type="text" name="textfield[]" />
      <input type="submit" name="Submit" value="Submit" />
    </form>
    <p>&nbsp;</p>
    <p><a href="phpinfo.php">Click here to see php info</a></p>
    </body>
    </html>
    
    
    Code (markup):

     
    RichestGirl, Sep 8, 2009 IP
  2. premiumscripts

    premiumscripts Peon

    Messages:
    1,062
    Likes Received:
    48
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I'd venture a guess that your requests are being rewritten to GETs instead of POSTs, loosing the POST array in the process. Probably some htaccess problem. You can check to see if the request is sent correctly with the firefox addon "tamper data".
     
    premiumscripts, Sep 8, 2009 IP
    RichestGirl likes this.
  3. RichestGirl

    RichestGirl Greenhorn

    Messages:
    83
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #3
    Hi premiumscripts,

    Thanks for quick response but If I use all variables $_GET, $_REQUEST or $_POST it give me same results.
    additionally I have checked .htaccess file. It was empty and I have tested by removing it but still same issue.

    Please Advise different Tip/Trick if you know
     
    RichestGirl, Sep 8, 2009 IP
  4. premiumscripts

    premiumscripts Peon

    Messages:
    1,062
    Likes Received:
    48
    Best Answers:
    0
    Trophy Points:
    0
    #4
    If you would put it on a http page instead of https I could do some further testing..
     
    premiumscripts, Sep 8, 2009 IP
  5. RichestGirl

    RichestGirl Greenhorn

    Messages:
    83
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #5
    But my client require it to be hosted on secure server.

    I have to put it on https only :(
     
    RichestGirl, Sep 8, 2009 IP
  6. premiumscripts

    premiumscripts Peon

    Messages:
    1,062
    Likes Received:
    48
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Just for testing purposes.
     
    premiumscripts, Sep 8, 2009 IP
  7. szalinski

    szalinski Peon

    Messages:
    341
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #7
    you're probably using php4 or some really old php which you'd need $HTTP_POST_VARS (I think).
     
    szalinski, Sep 8, 2009 IP