POST and GET

Batch / Cmd
March 30, 2010 at 11:03:03
Specs: Windows XP, Dunno?
POST and GET wont work right?
Don't know what i'm talking about? let me show
you!

[PAGE1]:
<form action="PAGE2.php" method="POST">
<input type="text" name="random">
<input type="submit" value="post it!">
</form>
[/PAGE1]

[PAGE2]:
echo $_POST["random"];
[/PAGE2]


now listen, if you use the above, it'll work fine!
BUT! if you do it like this..


[PAGE1]:
<form action="PAGE2.php" method="POST">
<input type="text" name="random">
<input type="submit" value="post it!">
[/PAGE1]

[PAGE2]:
$dom->save('$_POST["random"].xml');
[/PAGE2]


then it saves the "xml" file in this example
as "$_POST["random"].xml" instead of the
"random" input.. -.-'

please try to understand, thx.

-neoz


See More: POST and GET

Report •


#1
April 1, 2010 at 01:07:29
It's the difference between a single quote (') and a double quote(")

http://php.net/manual/en/language.t...


Report •

#2
April 28, 2010 at 10:00:11
Use
$dom->save($_POST["random"] . '.xml');

Trying to embed an element reference within a "quoted string" is somewhat unpredictable -- best to bring the array element reference outside of any string.


Report •
Related Solutions


Ask Question