Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 11 of 11

Thread: please help me

  1. #1
    Regular Coder
    Join Date
    Jun 2002
    Location
    England, Hythe
    Posts
    207
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy 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

  • #2
    New Coder
    Join Date
    Jun 2002
    Posts
    70
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  • #3
    Regular Coder
    Join Date
    Jun 2002
    Location
    England, Hythe
    Posts
    207
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  • #4
    Regular Coder
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    183
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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...

  • #5
    Senior Coder
    Join Date
    Jun 2002
    Location
    paris, france
    Posts
    1,216
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  • #6
    Regular Coder
    Join Date
    Jun 2002
    Location
    England, Hythe
    Posts
    207
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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);
    ?>

  • #7
    New Coder
    Join Date
    Jul 2002
    Location
    ISRAEL
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Pleas do not write subject like:
    "please help me"
    "very important!"
    etc etc...

    it is very annoying!

  • #8
    New Coder
    Join Date
    Jul 2002
    Location
    ISRAEL
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #9
    Regular Coder
    Join Date
    Jun 2002
    Location
    England, Hythe
    Posts
    207
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  • #10
    Regular Coder
    Join Date
    Jul 2002
    Location
    London, UK
    Posts
    126
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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!

  • #11
    Regular Coder
    Join Date
    Jun 2002
    Location
    England, Hythe
    Posts
    207
    Thanks
    0
    Thanked 0 Times in 0 Posts
    i changed the "register_globals" to "on" and it works now

    tahnks for the help


  •  

    Posting Permissions

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