HTML Form Post isn’t passing variables to PHP
Hello all,
I am running Windows 98, PHP Triad Apache 1.3.14 webserver, recently upgraded PHP to 4.0.5 and my forms aren’t passing the variables to PHP anymore.
File php1.php:
<html>
<form action="php2.php" method="post">
<input type=text name="abc">
<input type=submit>
</form>
</html>
File php2.php:
<html>
<?php
echo "[".$abc."]" ;
?>
</html>
Output from connecting to php1.php (after filling in the field and clicking on “Submit Query”):
Warning: Undefined variable: abc in C:\apache\htdocs\php2.php on line 3
[]
Thanks,
Charlie
chvol@aol.com
HTML Form Post isn’t passing variables to PHP
Moderator: General Moderators
- Heavy
- Forum Contributor
- Posts: 478
- Joined: Sun Sep 22, 2002 7:36 am
- Location: Viksjöfors, Hälsingland, Sweden
- Contact:
I don't know what PHP triad is, but if it was PHP I would state:
Check your php.ini file. Is register_globals set to On or Off?
I have it Off.
That means I can only (which is very very good) access the post vars by using the form:
$_POST['Varname']
instead, where $_POST is an array containing all posted vars accessible by entering their names as indices.
Check your php.ini file. Is register_globals set to On or Off?
I have it Off.
That means I can only (which is very very good) access the post vars by using the form:
$_POST['Varname']
instead, where $_POST is an array containing all posted vars accessible by entering their names as indices.
just wondering... will it work if u put
It works with extract['$_GET];
Code: Select all
extractї'$_POST'];Re: HTML Form Post isn’t passing variables to PHP
The thing you have to do (and I think this is was Heavy meant) is:
-- PHP1 --
-- PHP 2 --
GET can normally be used ever but in case of textareas with a large amount of content, for file upload fields or password fields it shouln't. Then just change it to POST.
-- PHP1 --
Code: Select all
<?php
echo "<FORM ACTION="php2" METHOD=GET>\n";
echo "<input type "text" NAME="abc" value"some value">\n";
echo "<FORM>\n";
?>Code: Select all
<?php
$abc = $_GETї'abc'];
# if you use another form
echo "<FORM>\n";
echo "<input type "text" NAME="abc" value"$abc">\n";
echo "<FORM>\n";
#if you'd like to just print it out
echo "$abc\n";
?>- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
CONFIQ:
will work
won't.
http://www.php.net/manual/en/function.extract.php
Mac
Code: Select all
extract($_POST);Code: Select all
extractї'$_POST'];http://www.php.net/manual/en/function.extract.php
Mac