#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    4
    Rep Power
    0

    Problem with $_POST METHOD


    Hi, I'm using Xampp Server but I have problem with form & $_POST method
    I create two files (POST.PHP) and (welcome.php)
    my problem I can't get any data in second file (welcome.php)
    empty page >>> why


    POST.PHP

    PHP Code:
    <html> <body>  <form action="welcome.php" method="post"Name: <input type="text" name="fname"/> <input type="submit" value="Submit"/> </form>  </body> </html

    welcome.PHP

    PHP Code:
    <html> <body>  <?php echo $_POST["fname"];  ?>  </body> </html>

    PHP 5.2.0
  2. #2
  3. --
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2012
    Posts
    3,959
    Rep Power
    1014
    Hi,

    in the developer tools of your browser, open the "Network" tab and then the "Headers" tab to see what gets posted where. If you don't know where to find this, google for it or read the manual of your browser.

    You should also avoid CaSe SeNsItiVe FiLe NaMeS. As pretty as they may be, they lead to all kinds of problems (this also applies to names in databases).
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    4
    Rep Power
    0
    Thank you Jacques1 for your reply

    this what i get for first file
    [10:23:11.391] A form was submitted in the windows-1252 encoding which cannot encode all Unicode characters, so user input may get corrupted. To avoid this problem, the page should be changed so that the form is submitted in the UTF-8 encoding either by changing the encoding of the page itself to UTF-8 or by specifying accept-charset=utf-8 on the form element. @ file:///C:/xampp/htdocs/post.php


    & second file

    [10:23:11.483] The character encoding of the HTML document was not declared. The document will render with garbled text in some browser configurations if the document contains characters from outside the US-ASCII range. The character encoding of the page must be declared in the document or in the transfer protocol. @ file:///C:/xampp/htdocs/welcome.php


    I'm using Firefox version 17.0
  6. #4
  7. No Profile Picture
    Lost in code
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 2004
    Posts
    8,316
    Rep Power
    7170
    What is the value of the address bar in your browser after you submit the form?
    PHP FAQ

    Originally Posted by Spad
    Ah USB, the only rectangular connector where you have to make 3 attempts before you get it the right way around
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    4
    Rep Power
    0
    after submit

    file:///C:/xampp/htdocs/welcome.php
  10. #6
  11. Mad Scientist
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Oct 2007
    Location
    North Yorkshire, UK
    Posts
    3,661
    Rep Power
    4124
    And there's the problem

    In your set up PHP will not be executed unless it is run through a web server

    try going to

    http://localhost/POST.PHP

    to start with; then, hopefully, you'll end up at

    http://localhost/welcome.PHP

    oh, and as a general rule, make your file names and extensions lower case
    I said I didn't like ORM!!! <?php $this->model->update($this->request->resources[0])->set($this->request->getData())->getData('count'); ?>

    PDO vs mysql_* functions: Find a Migration Guide Here

    [ Xeneco - T'interweb Development ] - [ Are you a Help Vampire? ] - [ Read The manual! ] - [ W3 methods - GET, POST, etc ] - [ Web Design Hell ]
  12. #7
  13. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    4
    Rep Power
    0
    There is Problem in php.ini file configrution with Xampp Server , when i run my script on apache server it's work after active register_global

    Apache Server version 2.5.10

    Thanks Jacques1 ,E-Oreo , Northie
  14. #8
  15. No Profile Picture
    Lost in code
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 2004
    Posts
    8,316
    Rep Power
    7170
    Do not enable register_globals. You should not be using or writing any code that uses it. It has been deprecated for over 3 years, and 6 months ago it was completely removed from PHP. If you use it, your scripts will break permanently as soon as you upgrade PHP and the only way to fix them will be to rewrite the code so it doesn't use register_globals.
    PHP FAQ

    Originally Posted by Spad
    Ah USB, the only rectangular connector where you have to make 3 attempts before you get it the right way around

IMN logo majestic logo threadwatch logo seochat tools logo