PDA

View Full Version : help sending form vars with php


oldmanstan
June 13th, 2006, 09:01 PM
ok, i am writing a wordpress plugin and it is in two files. apparently the second file can't access wordpress functions, only the main one (which I thought was kinda weird but i'll deal with it later)

anyway, the second file just returns an image so i need it to know the path i want it to look in but when i put something with slashes as a "get" variable it doesn't like it

for instance www.something.com/index.php?dir=/home/bob/

doesn't work

is there a php function to clean up the forward slashes?

johnnymac
June 13th, 2006, 10:13 PM
I believe if you set it up as a POST you'd probably get past the issue of having to clean anything up. Or, you can have it go to a dummy page that just relocates the browser to the directory you want it to go into.

oldmanstan
June 13th, 2006, 10:22 PM
yeah, see the problem is that i'm not actually sending the info with a form, otherwise i would use the post method, but i'm directly calling the script from an <img> tag, i.e. <img src='somesuch.php?file=hello.jpg'/>

thanks for the help though, anyone else have any ideas?

oldmanstan
June 13th, 2006, 10:30 PM
EDIT: i'm an idiot, apparently i had a different bug in the script that was causing the problem and it only seemed to trace back to the GET string, problem solved

blm126
June 13th, 2006, 10:49 PM
Have you looked at the urlencode (http://us3.php.net/manual/en/function.urlencode.php) function. It should get rid of the slashes for you.