form help

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • John

    form help

    Hello.

    I am a beginner to PHP and I am currently just going through a book,
    to create a simple form page. Unfortunately it doesn't work, and
    there is nothing listed on the books errata page on the internet.

    I wondered if you can just help me with it?

    It is just a form that you type your name in on the test_form.php
    page, and then on the test_form_proce ssor.php page it is supposed to
    say Thank you, yourname, for completing the form. It doesn't display
    the name you type in though.


    Below is a copy of the code for the two pages:

    test_form.php

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html;
    charset=iso-8859-1" />
    <title>Untitl ed Document</title>
    </head>

    <body>
    <form name="frm_name" id="frm_name" method="post"
    action="test_fo rm_processor.ph p">
    First Name
    <input name="firstName " type="text" id="firstName" />
    </form>
    </body>
    </html>


    test_form_proce ssor.php

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html;
    charset=iso-8859-1" />
    <title>Untitl ed Document</title>
    </head>

    <body>
    <p>Thank you, <?php echo $_POST['firstName']; ?>, for filling out my
    form.
    </p>
    </body>
    </html>


    Thanks very much for any help you can offer.

    John


  • Matthias Esken

    #2
    Re: form help

    John wrote:
    [color=blue]
    > I am a beginner to PHP and I am currently just going through a book,
    > to create a simple form page. Unfortunately it doesn't work, and
    > there is nothing listed on the books errata page on the internet.
    >
    > [...]
    >
    > <p>Thank you, <?php echo $_POST['firstName']; ?>, for filling out my form.[/color]

    Please tell us your PHP version. If you don't know it, then just execute
    the function phpinfo().

    Regards,
    Matthias

    Comment

    • John

      #3
      Re: form help

      On Thu, 13 May 2004 00:14:58 +0200, Matthias Esken
      <muelleimer2004 nospam@usenetve rwaltung.org> wrote:
      [color=blue]
      >John wrote:
      >[color=green]
      >> I am a beginner to PHP and I am currently just going through a book,
      >> to create a simple form page. Unfortunately it doesn't work, and
      >> there is nothing listed on the books errata page on the internet.
      >>
      >> [...]
      >>
      >> <p>Thank you, <?php echo $_POST['firstName']; ?>, for filling out my form.[/color]
      >
      >Please tell us your PHP version. If you don't know it, then just execute
      >the function phpinfo().
      >
      >Regards,
      > Matthias[/color]

      Hi. I have version 4.3.6.

      Thanks
      John


      Comment

      • Pedro Graca

        #4
        Re: form help

        John wrote:[color=blue]
        > On Thu, 13 May 2004 00:14:58 +0200, Matthias Esken
        ><muelleimer200 4nospam@usenetv erwaltung.org> wrote:
        >[color=green]
        >>John wrote:[/color][/color]
        [color=blue][color=green][color=darkred]
        >>> <p>Thank you, <?php echo $_POST['firstName']; ?>, for filling out my form.[/color][/color][/color]
        [color=blue][color=green]
        >>Please tell us your PHP version. If you don't know it, then just execute
        >>the function phpinfo().[/color][/color]
        [color=blue]
        > Hi. I have version 4.3.6.[/color]

        Please tell us what is the output of this script:


        == cut ======
        <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
        <html xmlns="http://www.w3.org/1999/xhtml">
        <head>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
        <title>Test</title>
        </head>

        <body>
        <p style="font-size: x-large"><?php echo 'one '; ?>two</p>
        </body>
        </html>
        == cut ======


        Save it to your server and access it ( http://localhost/saved.php )
        I'm trying to verify if your server is configured to serve php files.

        Is it "one"?
        Maybe "two"?

        or "one two"?


        If it is "two" what do you see as the source of the page?

        --
        USENET would be a better place if everybody read: : mail address :
        http://www.catb.org/~esr/faqs/smart-questions.html : is valid for :
        http://www.netmeister.org/news/learn2quote2.html : "text/plain" :
        http://www.expita.com/nomime.html : to 10K bytes :

        Comment

        • John

          #5
          Re: form help

          On 12 May 2004 23:21:51 GMT, Pedro Graca <hexkid@hotpop. com> wrote:
          [color=blue]
          >John wrote:[color=green]
          >> On Thu, 13 May 2004 00:14:58 +0200, Matthias Esken
          >><muelleimer20 04nospam@usenet verwaltung.org> wrote:
          >>[color=darkred]
          >>>John wrote:[/color][/color]
          >[color=green][color=darkred]
          >>>> <p>Thank you, <?php echo $_POST['firstName']; ?>, for filling out my form.[/color][/color]
          >[color=green][color=darkred]
          >>>Please tell us your PHP version. If you don't know it, then just execute
          >>>the function phpinfo().[/color][/color]
          >[color=green]
          >> Hi. I have version 4.3.6.[/color]
          >
          >Please tell us what is the output of this script:[/color]

          Hi. It just displays the webpage with the following text:

          Thank you, , for filling out my form.

          It doesn't have the name that was entered displayed.

          Cheers

          John


          Comment

          • Pedro Graca

            #6
            Re: form help

            John wrote:[color=blue]
            > On 12 May 2004 23:21:51 GMT, Pedro Graca <hexkid@hotpop. com> wrote:
            >[color=green]
            >>John wrote:[color=darkred]
            >>> On Thu, 13 May 2004 00:14:58 +0200, Matthias Esken
            >>><muelleimer2 004nospam@usene tverwaltung.org > wrote:
            >>>
            >>>>John wrote:[/color]
            >>[color=darkred]
            >>>>> <p>Thank you, <?php echo $_POST['firstName']; ?>, for filling out my form.[/color]
            >>[color=darkred]
            >>>>Please tell us your PHP version. If you don't know it, then just execute
            >>>>the function phpinfo().[/color]
            >>[color=darkred]
            >>> Hi. I have version 4.3.6.[/color]
            >>
            >>Please tell us what is the output of this script:[/color]
            >
            > Hi. It just displays the webpage with the following text:
            >
            > Thank you, , for filling out my form.
            >
            > It doesn't have the name that was entered displayed.[/color]

            I didn't mean your script ... but OK :)

            What URL do you use to see that with your browser?

            For PHP to execute the URL *has to* start with "http://".

            --
            USENET would be a better place if everybody read: : mail address :
            http://www.catb.org/~esr/faqs/smart-questions.html : is valid for :
            http://www.netmeister.org/news/learn2quote2.html : "text/plain" :
            http://www.expita.com/nomime.html : to 10K bytes :

            Comment

            • Theo

              #7
              Re: form help

              John <dafi@duc.com > wrote in news:rd75a051rm 4nrakmg8lq508jl 7im4lf95l@
              4ax.com:
              [color=blue]
              > Thanks very much for any help you can offer.[/color]

              copypasted both and they work fine. so if phpinfo works then its probably
              where you are running the two files from.

              Comment

              • John

                #8
                Re: form help

                Hi.

                The URL I use is http://localhost/newland/

                All the files are saved to the following location:
                C:\Program Files\Apache Group\Apache2\h tdocs\newland

                Thanks

                John


                Comment

                • Pedro Graca

                  #9
                  Re: form help

                  John wrote:[color=blue]
                  > The URL I use is http://localhost/newland/[/color]

                  Right!
                  [color=blue]
                  > All the files are saved to the following location:
                  > C:\Program Files\Apache Group\Apache2\h tdocs\newland[/color]

                  Right-click the page and select "View Source" (or similar).

                  What shows up?

                  In the HTML part where your name should be?

                  [ I'm guessing you'll see <?php echo $_POST['firstName']; ?> ... ]

                  --
                  USENET would be a better place if everybody read: : mail address :
                  http://www.catb.org/~esr/faqs/smart-questions.html : is valid for :
                  http://www.netmeister.org/news/learn2quote2.html : "text/plain" :
                  http://www.expita.com/nomime.html : to 10K bytes :

                  Comment

                  • jsWalter

                    #10
                    Re: form help

                    Interesting, your code worked for me.

                    As Matthias asked, what does...

                    php_test.php (yea, that's it, one line)

                    <?php echo phpinfo() ?>

                    what does this give you?

                    Walter


                    Comment

                    • Weinhandl Herbert

                      #11
                      Re: form help

                      John wrote:

                      ....
                      [color=blue]
                      >
                      > Below is a copy of the code for the two pages:
                      >
                      > test_form.php[/color]

                      ....[color=blue]
                      > <body>
                      > <form name="frm_name" id="frm_name" method="post"
                      > action="test_fo rm_processor.ph p">
                      > First Name
                      > <input name="firstName " type="text" id="firstName" />[/color]

                      I think that the submit button is missing in your script :-(
                      try adding

                      <input type="submit" value="Send input to PHP-eval-script" />

                      into your form
                      [color=blue]
                      > </form>
                      > </body>[/color]

                      ....
                      [color=blue]
                      > Thanks very much for any help you can offer.
                      >
                      > John[/color]

                      Happy PHP-programming

                      Herbert

                      Comment

                      • John

                        #12
                        Re: form help

                        On 13 May 2004 00:05:24 GMT, Pedro Graca <hexkid@hotpop. com> wrote:
                        [color=blue]
                        >John wrote:[color=green]
                        >> The URL I use is http://localhost/newland/[/color]
                        >
                        >Right!
                        >[color=green]
                        >> All the files are saved to the following location:
                        >> C:\Program Files\Apache Group\Apache2\h tdocs\newland[/color]
                        >
                        >Right-click the page and select "View Source" (or similar).
                        >
                        >What shows up?
                        >
                        >In the HTML part where your name should be?
                        >
                        > [ I'm guessing you'll see <?php echo $_POST['firstName']; ?> ... ][/color]


                        Yes. I get the following code...

                        <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
                        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
                        <html xmlns="http://www.w3.org/1999/xhtml">
                        <head>
                        <meta http-equiv="Content-Type" content="text/html;
                        charset=iso-8859-1" />
                        <title>Untitl ed Document</title>
                        </head>

                        <body>
                        <p>Thank you, <?php echo $_POST['firstName']; ?>, for filling out my
                        form.
                        </p>
                        </body>
                        </html>


                        John


                        Comment

                        • John

                          #13
                          Re: form help

                          On Thu, 13 May 2004 06:36:01 GMT, "jsWalter"
                          <jsWalter@KILLt orresSPAM.ws> wrote:
                          [color=blue]
                          >Interesting, your code worked for me.
                          >
                          >As Matthias asked, what does...
                          >
                          >php_test.php (yea, that's it, one line)
                          >
                          ><?php echo phpinfo() ?>
                          >
                          >what does this give you?[/color]

                          Walter, I don't understand what you mean? Do you want me to type this
                          in the box "php_test.p hp" before hitting enter to see what it gives?

                          John

                          Comment

                          • John

                            #14
                            Re: form help

                            On Thu, 13 May 2004 09:21:18 +0200, Weinhandl Herbert
                            <weinhand@unile oben.ac.at> wrote:
                            [color=blue]
                            >John wrote:
                            >
                            >...
                            >[color=green]
                            >>
                            >> Below is a copy of the code for the two pages:
                            >>
                            >> test_form.php[/color]
                            >
                            >...[color=green]
                            >> <body>
                            >> <form name="frm_name" id="frm_name" method="post"
                            >> action="test_fo rm_processor.ph p">
                            >> First Name
                            >> <input name="firstName " type="text" id="firstName" />[/color]
                            >
                            >I think that the submit button is missing in your script :-(
                            >try adding
                            >
                            > <input type="submit" value="Send input to PHP-eval-script" />
                            >
                            >into your form
                            >[color=green]
                            >> </form>
                            >> </body>[/color]
                            >
                            >...
                            >[color=green]
                            >> Thanks very much for any help you can offer.
                            >>
                            >> John[/color]
                            >
                            >Happy PHP-programming
                            >
                            >Herbert[/color]

                            It's just a basic form without a submit button this one. It's the
                            first lesson in the book towards building a dynamic site. It's just
                            one where you hit the enter key. Either way whether it's a submit
                            button or the enter key, I think the result will be the same. It's got
                            to be something else, probably really simple (knowing my luck) that is
                            the problem :(

                            John


                            Comment

                            • jsWalter

                              #15
                              Re: form help


                              "John" <dafi@duk.com > wrote in message
                              news:ch77a01f4e 9vr1bdcrrus7qtk 5fl30upml@4ax.c om...[color=blue]
                              > On Thu, 13 May 2004 06:36:01 GMT, "jsWalter"
                              > <jsWalter@KILLt orresSPAM.ws> wrote:
                              >[color=green]
                              > >Interesting, your code worked for me.
                              > >
                              > >As Matthias asked, what does...
                              > >
                              > >php_test.php (yea, that's it, one line)
                              > >
                              > ><?php echo phpinfo() ?>
                              > >
                              > >what does this give you?[/color]
                              >
                              > Walter, I don't understand what you mean? Do you want me to type this
                              > in the box "php_test.p hp" before hitting enter to see what it gives?[/color]

                              No sir.

                              Create a file named php_test.php

                              put ><?php echo phpinfo() ?> in that file

                              run that file

                              Then, if you could post the result page on your web server and give us the
                              URL, "we" can look it over.

                              This will tell "us" if your configuration is proper.

                              It looks like, to me, that your PHP is not processing as it should.

                              Walter



                              Comment

                              Working...