View Full Version : please help me
Bluemonkey
07-03-2002, 01:45 PM
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
ObiwanJebroni
07-03-2002, 02:06 PM
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?
Bluemonkey
07-03-2002, 02:14 PM
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
SYP}{ER
07-03-2002, 02:32 PM
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 :)
whackaxe
07-03-2002, 02:40 PM
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
print("the script was executed sucesfully!");
or whatever phrase you wish. or you could redirect the user
header("location:www.google.com")
Bluemonkey
07-03-2002, 02:50 PM
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);
?>
gmorphus
07-06-2002, 03:16 AM
Pleas do not write subject like:
"please help me"
"very important!"
etc etc...
it is very annoying!
gmorphus
07-06-2002, 03:29 AM
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.
Bluemonkey
07-08-2002, 09:10 AM
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
Mouldy_Goat
07-08-2002, 11:57 AM
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:
----------------------------------------------------------
<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:
---------------------------------------------------------
<?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
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!
Bluemonkey
07-08-2002, 12:44 PM
i changed the "register_globals" to "on" and it works now
tahnks for the help
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.