Page 1 of 1

quick PHP help needed

Posted: Tue Aug 26, 2003 2:05 am
by stagnant filth
ok well ill admit that im very new to php and im just starting to learn. i have a problem that i hope one of you can solve for me. im having trouble passing information from a form in a html file to a separate php file.

what im dealing with now is something like this:
---the html file with the form ----

<html>
<head>
<title>Untitled Document</title>
</head>

<body>
<form method="post" action="calculate.php">
<input name="one" type="text">
<input type="submit" value="blah" name="submit">
</form>
</body>
</html>

----and this is calculate.php----

<?php
echo "$one";
?>



so what am i doing wrong?

Posted: Tue Aug 26, 2003 2:35 am
by gite_ashish
check this:
Before Post Read: Concerning Passing Variables in PHP 4.2+
(viewtopic.php?t=511&start=0&postdays=0& ... 1c5400f616)

Posted: Tue Aug 26, 2003 2:40 am
by stagnant filth
ahhh yes. as i said..complete newbie here. thanks a lot for the help. :)

Posted: Tue Aug 26, 2003 2:52 am
by Orkan
If you have problem with "Note: undefined variable..." - you need to check register_globals in your php.ini file. If the parameter is "off" you need to use $HTTP_POST_VARS[] array to get posted var:

Code: Select all

<?php
$var=$HTTP_POST_VARS["var"];
echo $var;
?>
This should work.

Posted: Tue Aug 26, 2003 2:55 am
by stagnant filth
is there anyway to change the parameter to on ?

yeah!

Posted: Tue Aug 26, 2003 3:02 am
by Orkan
Just edit the php.ini file :)
If you have no access to it - then I don't know... :(
I'm a newbie too :)