php4.3.2 can't get POST to work.

Ask a Question related to PHP Development, Design and Development.

  1. #1

    Default php4.3.2 can't get POST to work.

    Hello,

    I've installed php4.3.2 on my Redhat 8.0 box along with Apache2.046.
    I'm trying to teach myself some php using Larry Ullman's book "PHP for
    the World Wide Web".

    There's one example I typed just as it appears in the book but it
    dosen't work. I was wondering if there was some setting that needs to
    be set in the php config for it to work.

    The script is a simple html script, which calls a php script passing
    it the variables which it got by the forms:

    #########HTML SCRIPT###################
    <html>
    <head>
    <title>HTML Form</title>
    </head>
    <body>
    <form ACTION="HandleForm.php" METHOD=POST>
    First Name<input TYPE=TEXT NAME="FirstName" SIZE=20><br>
    Last Name <input TYPE=TEXT NAME="LastName" SIZE=20><br>
    E-mail Address <input TYPE=TEXT NAME="Email" SIZE=60><br>
    Comments <textarea NAME="Comments" ROWS=5 COLS=40></textarea><br>
    <input TYPE=SUBMIT NAME="SUBMIT" VALUE="Submit!">
    </form>

    </body>
    </html>

    ##############PHP SCRIPT "HandleForm.php"#####################
    <HTML>
    <HEAD>
    <TITLE>Form Results</title>
    <BODY>
    <?php
    /* This page receives and handles the data generated by "form.html".
    */
    print "Your first name is $FirstName.<BR>\n";
    print "Your last name is $LastName.<BR>\n";
    print "Your E-mail is $Email.<BR>\n";
    print "This is what you had to say:<BR>\n$Comments<BR>\n";
    ?>
    </BODY>
    </HTML>

    ####
    This is the output:


    Your first name is .
    Your last name is .
    Your E-mail is .
    This is what you had to say:


    All the variables are apparently empty. I've also tried with the GET
    method. Any idea of what could be wrong in either my script or php
    settings ?

    Acteon
    Acteon Guest

  2. Similar Questions and Discussions

    1. Webservices - POST and GET do not work
      Hi there, I wrote a simple Webservice, which works fine on my local(!) machine. I can send data to this service via SOAP, GET and POST. When...
    2. Form Post Doesn't Work
      I have RH9 Linux with the versions of Apache and PHP that came with it. The PHP is version 4.2.2 on the CD, I believe. Apache, I think, is version...
    3. Post method doesn't work
      [email protected] (DrPollo) wrote in news:219e7b39.0307220905.382bb188 @posting.google.com: the $_ superglobals were introduced in PHP...
    4. post back doesn't work
      On Tue, 22 Jul 2003 20:01:44 -0400, "[email protected]" <[email protected]> wrote: I bet you have somewhere in that form an html submit...
    5. Post method doesn't work: correction
      DrPollo wrote: Just tested it here, works fine. However, I don't allow php_shorttag, had to change it to <?php ?> Maybe you can't use...
  3. #2

    Default Re: php4.3.2 can't get POST to work.

    As the other fellow said, do a search for register_globals.

    Try using $_POST["myvariable"] and $_GET["myvariable"] to read from
    variables, instead of $myvariable. (where myvariable is the name of an
    object in the submitted form).

    "Acteon" <[email protected]> wrote in message
    news:[email protected] om...
    > Hello,
    >
    > I've installed php4.3.2 on my Redhat 8.0 box along with Apache2.046.
    > I'm trying to teach myself some php using Larry Ullman's book "PHP for
    > the World Wide Web".
    >
    > There's one example I typed just as it appears in the book but it
    > dosen't work. I was wondering if there was some setting that needs to
    > be set in the php config for it to work.
    >
    > The script is a simple html script, which calls a php script passing
    > it the variables which it got by the forms:
    >
    > #########HTML SCRIPT###################
    > <html>
    > <head>
    > <title>HTML Form</title>
    > </head>
    > <body>
    > <form ACTION="HandleForm.php" METHOD=POST>
    > First Name<input TYPE=TEXT NAME="FirstName" SIZE=20><br>
    > Last Name <input TYPE=TEXT NAME="LastName" SIZE=20><br>
    > E-mail Address <input TYPE=TEXT NAME="Email" SIZE=60><br>
    > Comments <textarea NAME="Comments" ROWS=5 COLS=40></textarea><br>
    > <input TYPE=SUBMIT NAME="SUBMIT" VALUE="Submit!">
    > </form>
    >
    > </body>
    > </html>
    >
    > ##############PHP SCRIPT "HandleForm.php"#####################
    > <HTML>
    > <HEAD>
    > <TITLE>Form Results</title>
    > <BODY>
    > <?php
    > /* This page receives and handles the data generated by "form.html".
    > */
    > print "Your first name is $FirstName.<BR>\n";
    print "Your first name is $_POST["FirstName"].<BR>\n";
    > print "Your last name is $LastName.<BR>\n";
    print "Your last name is $_POST["LastName"].<BR>\n";
    > print "Your E-mail is $Email.<BR>\n";
    print "Your E-mail is $_POST["Email"].<BR>\n";
    > print "This is what you had to say:<BR>\n$Comments<BR>\n";
    print "This is what you had to say:<BR>\n$_POST["Comments"]<BR>\n";
    > ?>
    > </BODY>
    > </HTML>
    >
    > ####
    > This is the output:
    >
    >
    > Your first name is .
    > Your last name is .
    > Your E-mail is .
    > This is what you had to say:
    >
    >
    > All the variables are apparently empty. I've also tried with the GET
    > method. Any idea of what could be wrong in either my script or php
    > settings ?
    >
    > Acteon

    Richard Hockey Guest

  4. #3

    Default Re: php4.3.2 can't get POST to work.

    "Richard Hockey" <[email protected]> wrote in message news:<3f0bccef$0$15035$[email protected] m>...
    > As the other fellow said, do a search for register_globals.
    >
    > Try using $_POST["myvariable"] and $_GET["myvariable"] to read from
    > variables, instead of $myvariable. (where myvariable is the name of an
    > object in the submitted form).
    Thank you, that solved the problem. I ended up declaring my variables
    on top:

    $FirstName = $_POST["FirstName"];
    $LastName = $_POST["LastName"];

    and so on.

    This way If I need to use the variable more then once I won't need to
    keep typing $_POST["varname"]. Is that how php coders usually do it ?
    Acteon Guest

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139