|
Posted by Lars Eighner on 10/12/07 08:02
In our last episode, <1192164404.526476.12410@y27g2000pre.googlegroups.com>,
the lovely and talented deja@icepick.com broadcast on comp.lang.php:
> Jerry,
> I simplified my webpage to
><?php
> echo $_GET['var1'];
> echo $_GET['var2'];
> echo $_GET['var3'];
> ?>
> And the url I use now to test is (besides the example part)
> www.example.com/php/blah.php?var1=test&var2=blahblah&var3=candy
> When I do this it only returns one variable.
> There must be something simple I am missing here..
Are you doing this from the command line? If so, you should single quote
the url because your shell is interpreting the ampersand, not passing it
through.
so for example in bash or sh:
Fri Oct 12 02:49:34 bash3.2:ttyp0:lars
debranded~$lynx -dump http://localhost/~work/index.php?var1=test&var2=blah\
blah&var3=candy
[1] 5661
[2] 5662
Fri Oct 12 02:51:12 bash3.2:ttyp0:lars
debranded~$test
You got test as expected by setting var1, but the shell has done its own
thing with everything after the first &.
Single quote it and it will pass the whole url through:
Fri Oct 12 02:54:33 bash3.2:ttyp0:lars
debranded~$lynx -dump 'http://localhost/~work/index?var1=test&var2=blah\
blah&var3=candy'
testblahblahcandy
Fri Oct 12 02:56:03 bash3.2:ttyp0:lars
debranded~$
Which is the right answer.
--
Lars Eighner <http://larseighner.com/> <http://myspace.com/larseighner>
Countdown: 466 days to go.
What do you do when you're debranded?
Navigation:
[Reply to this message]
|