Web Analytics Made Easy -
StatCounter please help me - CodingForum

Announcement

Collapse
No announcement yet.

please help me

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • please help me

    could some one please help me i am very new at php i have been doing a little tutorial and its got to form handelling and i have followed it word for word but when i run my form.html with my form.php handelling it my server brings up an error 200 and says o0k under it. whats going on why wont it display my form contents.

    any help would be very greatfull

    thanks
    Spoooooooon

  • #2
    What server are you running off of, do you have your PHP interpreter installed (though that's not the problem unless you inbedded PHP code within the html), and what exactly is the error the server is giving you?
    -Obiwan Jabroni
    May the Schwartz be With You

    Comment


    • #3
      i am running Abyss Web Server 1.0.3 i have a PHP interpreter installed and i think it is working fine because when i run .php files with simple stuff in them just simple if statmenst and echo's. it runs these fine but not when it is beging called form a html file.

      the error is:

      error 200

      ok
      Spoooooooon

      Comment


      • #4
        You can't run PHP in HTML files (unless you've specifically told the server to parse them) so that may be the problem. Or do you mean the form has action="blah.php"?

        Can we get a link, or at least show us the code? Hard to fix without
        Offtone.com - In the works...

        Comment


        • #5
          ah abyss, the mysterious error 200. if you went onto ther forums and searched around you might have seen tht error 200 means everything is peachy! this "error" is displayed when you dont output anything to the screen. to get rid of it just put this at the end of your script

          PHP Code:
          print("the script was executed sucesfully!"); 
          or whatever phrase you wish. or you could redirect the user

          PHP Code:
          header("location:www.google.com"
          photoshop too expensive? use the GIMP! www.gimp.org

          Comment


          • #6
            but why isnt it printing my form contents

            <form action="FormHandler.php" method="POST">
            <input type="text" name="FirstElement">
            <input type="text" name="SecondElement">
            <input type="submit" value="Send form">
            </form>


            <?php
            echo($FirstElement);
            echo($SecondElement);
            ?>
            Spoooooooon

            Comment


            • #7
              Pleas do not write subject like:
              "please help me"
              "very important!"
              etc etc...

              it is very annoying!
              " When you have to shoot, SHOOT! don't talk! "
              - Great philosophy for life

              Comment


              • #8
                this part:
                Originally posted by Bluemonkey
                <?php
                echo($FirstElement);
                echo($SecondElement);
                ?>
                is supposed to be in the destination file and not in the file which contain the form.
                i mean, it can be there, but than it has to be the destination file also (destination is the action URL...)

                if you want the PHP part will be in the form page a few conditions have to apply:
                1. the form file have to have a PHP extension.
                2. the action URL should be the same page, or even better: replace the url with: <?=$PHP_SELF ?> . that way you won't have to change the action url if you change the name of the file.
                3. it will better if you will add in the php part:
                if ($submit) {
                echo($FirstElement);
                echo($SecondElement);
                }
                if you use this, i have to five to submit button a name, in this case "submit" but you can choose whatever yoiu want.

                Guy.
                " When you have to shoot, SHOOT! don't talk! "
                - Great philosophy for life

                Comment


                • #9
                  i tried this but now my server is saying that there is

                  Notice: Undefined variable: submit in C:\webser\htdocs\form.php on line 3
                  Spoooooooon

                  Comment


                  • #10
                    This is really confusing... I can't see why this isn't working - and that error message you said it came up with doesn't make much sense.

                    Ok, try this:

                    form.html:
                    ----------------------------------------------------------
                    Code:
                    <form action="FormHandler.php" method="POST"> 
                    <input type="text" name="FirstElement"> 
                    <input type="text" name="SecondElement"> 
                    <input type="submit" value="Send form"> 
                    </form>
                    FormHandler.php:
                    ---------------------------------------------------------
                    Code:
                    <?php
                    echo ($FirstElement);
                    echo ($SecondElement);
                    ?>
                    Oooh.. I've just had a thought actually - maybe your PHP configuration is setup so that you don't have any globals available.

                    Make a PHP script and have this as its contents:
                    <?php phpinfo(); ?>

                    Then under the PHP core bit (towards the top) see if register_globals is set to 'Off'.

                    If it is, you'll have to access the form variables with $HTTP_GET_VARS["FirstElement"] and $HTTP_GET_VARS["SecondElement"], I think.

                    So if you were to try and change FormHandler.php to:
                    PHP Code:
                    <?php
                    echo ($HTTP_GET_VARS["FirstElement"]);
                    echo (
                    $HTTP_GET_VARS["SecondElement"]);
                    ?>
                    I think it might work for you, if register_globals is set to 'Off', that is.

                    Oh and to fix the error of 'Undefined variable...' try using:
                    if (defined($submit)) {
                    ...
                    }

                    instead. I think the problem's because you've got your error reporting values set to report all warnings.

                    Sorry my reply's been a bit patchy and unclear - I hope you can get some sense out of it!

                    Comment


                    • #11
                      i changed the "register_globals" to "on" and it works now

                      tahnks for the help
                      Spoooooooon

                      Comment

                      Working...
                      X