Re: [PHP] Variable Passing
* Brad Brevet [EMAIL PROTECTED]: This seems to be what I was looking for, but I am curious, will the / be included in the variable? Will I have to do a stripslashes() command on it? If you echo out $_SERVER['PATH_INFO'] for the URL shown below, it will give you: /321 Usually what you do is something like: $pi = substr($_SERVER['PATH_INFO', 1); $args = explode('/', $pi); and then you'll have an array of arguments without the forward slashes. If you're only expecting a single argument, you can possibly skip that second step; if you want to limit the number of arguments you'll accept, you can add a third parameter to the explode() function call. You should still treat data passed in this way as tainted, just like data from the query string or a form. Scrub it and validate it before doing anything with it. Note: to get a script called 'something' to be parsed as PHP on your server, you'll need to do the following (assuming you're using Apache): create a .htaccess file in that directory with the contents: Files ~ (something)$ ForceType application/x-httpd-php /Files This will tell Apache that the file is a PHP script. Hans Juergen von Lengerke [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Brad Brevet: Hi, I am curious how to pass a variable without using something like id=321. I have seen sites that have something like http://www.website.com/something/321 and the variable is passed how exactly is that done? And is it called something specific so I know how to refer to it in the future? You can do that with $_SERVER[PATH_INFO]. If your script is /something, this variable will be set to /321 -- Matthew Weier O'Phinney | WEBSITES: Webmaster and IT Specialist | http://www.garden.org National Gardening Association| http://www.kidsgardening.com 802-863-5251 x156 | http://nationalgardenmonth.org mailto:[EMAIL PROTECTED] | http://vermontbotanical.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Variable Passing
What I do to control it only by PHP without using the mod_rewrite for apache is to use URL with this format: http://sample.com/script.php/param1/param2/param3 Then, work in the script looking at the variable $_SERVER['REQUEST_URI'] wich will contain, in this sample: /script.php/param1/param2/param3 You can explode the uri in an array: $params = explode('/', substr($_SERVER['REQUEST_URI'], 1); I used the substr dunction to remove the first slash. On the resulting array you will have, by index [0] = script.php [1] = param1 [2] = param2 [3] = param3 This works with Apache. I've not tested it on IIS, but suspect that it will not work on ISS. Hope this helps you. Jordi. On Apr 8, 2005 4:11 PM, Brad Brevet [EMAIL PROTECTED] wrote: Hi, I am curious how to pass a variable without using something like id=321. I have seen sites that have something like http://www.website.com/something/321 and the variable is passed how exactly is that done? And is it called something specific so I know how to refer to it in the future? Thanks, Brad -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Variable Passing
* Jordi Canals [EMAIL PROTECTED]: What I do to control it only by PHP without using the mod_rewrite for apache is to use URL with this format: http://sample.com/script.php/param1/param2/param3 Then, work in the script looking at the variable $_SERVER['REQUEST_URI'] wich will contain, in this sample: /script.php/param1/param2/param3 You can explode the uri in an array: $params = explode('/', substr($_SERVER['REQUEST_URI'], 1); I used the substr dunction to remove the first slash. On the resulting array you will have, by index [0] = script.php [1] = param1 [2] = param2 [3] = param3 This works with Apache. I've not tested it on IIS, but suspect that it will not work on ISS. I noted in a previous post, you can also do this using $_SERVER['PATH_INFO'] (though the first element from exploding will be the first parameter, and not the script name) -- and, to my understanding, this *does* work with IIS. (Somebody, correct me if I'm wrong.) Another note -- you can still pass a query string with either method -- which can make for some nice behaviour as well. On Apr 8, 2005 4:11 PM, Brad Brevet [EMAIL PROTECTED] wrote: Hi, I am curious how to pass a variable without using something like id=321. I have seen sites that have something like http://www.website.com/something/321 and the variable is passed how exactly is that done? And is it called something specific so I know how to refer to it in the future? -- Matthew Weier O'Phinney | WEBSITES: Webmaster and IT Specialist | http://www.garden.org National Gardening Association| http://www.kidsgardening.com 802-863-5251 x156 | http://nationalgardenmonth.org mailto:[EMAIL PROTECTED] | http://vermontbotanical.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Variable Passing
Hi, I am curious how to pass a variable without using something like id=321. I have seen sites that have something like http://www.website.com/something/321 and the variable is passed how exactly is that done? And is it called something specific so I know how to refer to it in the future? Thanks, Brad -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Variable Passing
On Apr 8, 2005 4:11 PM, Brad Brevet [EMAIL PROTECTED] wrote: Hi, I am curious how to pass a variable without using something like id=321. I have seen sites that have something like http://www.website.com/something/321 and the variable is passed how exactly is that done? And is it called something specific so I know how to refer to it in the future? Thanks, Brad -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php in fact thats probably for search engine optimization. Try http://www.seochat.com for more details and info. Basically apache will use a thing called the URL rewrite engine (it rewrites URL) to change http://www.website.com/something/321 into probably something like http://www.website.com/index.php?thing=somethingnumber=321. other ways of passing variables by not using URI: cookies session forms... POST / http/1.1 hope this helps... i am sorry if i haven't explained it properly enough. Ken -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Variable Passing
Brad Brevet: Hi, I am curious how to pass a variable without using something like id=321. I have seen sites that have something like http://www.website.com/something/321 and the variable is passed how exactly is that done? And is it called something specific so I know how to refer to it in the future? You can do that with $_SERVER[PATH_INFO]. If your script is /something, this variable will be set to /321 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Variable Passing
Brad Brevet wrote: Hi, I am curious how to pass a variable without using something like id=321. I have seen sites that have something like http://www.website.com/something/321 and the variable is passed how exactly is that done? And is it called something specific so I know how to refer to it in the future? That's done with a little bit of Apache's mod_rewrite magic ;). I suggest you to read this article [ http://www.sitepoint.com/article/guide-url-rewriting ] which is of a great help, however checking the manual reference ( google for 'mod_rewrite' ) will help you a lot too. If you get stuck somewhere, state your questions here :) Hope this helps, -- Josip Dzolonga http://josip.dotgeek.org jdzolonga[at]gmail.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Variable Passing
This seems to be what I was looking for, but I am curious, will the / be included in the variable? Will I have to do a stripslashes() command on it? Brad Hans Juergen von Lengerke [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Brad Brevet: Hi, I am curious how to pass a variable without using something like id=321. I have seen sites that have something like http://www.website.com/something/321 and the variable is passed how exactly is that done? And is it called something specific so I know how to refer to it in the future? You can do that with $_SERVER[PATH_INFO]. If your script is /something, this variable will be set to /321 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] variable passing using URL
hello list, I have a problem in passing variables using URLs. I have a link from a PHP 'Page One' and passing some variables thru URL. This link should now open another page (main frame) which will have two frames in it (left frame and Right frame). But I want the variables to be passed on to the left frame(one of the two frames in main frame). Can this be done some how? I apologize if this does not sound like a PHP question. Many thanks in advance. -- Ra. Gowthaman, Graduate Student, Bioinformatics Lab, Malaria Research Group, ICGEB , New Delhi. INDIA Phone: 91-9811261804 91-11-26173184; 91-11-26189360 #extn 314 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] variable passing using URL
Capture the variables you've sent to the main frame page and send them via the url of the frames. FRAME SRC=buttons.htm?pass=yourvariables Hope that helps. - Original Message - From: gowthaman ramasamy [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, May 14, 2004 2:24 AM Subject: [PHP] variable passing using URL hello list, I have a problem in passing variables using URLs. I have a link from a PHP 'Page One' and passing some variables thru URL. This link should now open another page (main frame) which will have two frames in it (left frame and Right frame). But I want the variables to be passed on to the left frame(one of the two frames in main frame). Can this be done some how? I apologize if this does not sound like a PHP question. Many thanks in advance. -- Ra. Gowthaman, Graduate Student, Bioinformatics Lab, Malaria Research Group, ICGEB , New Delhi. INDIA Phone: 91-9811261804 91-11-26173184; 91-11-26189360 #extn 314 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] R: [PHP] variable passing using URL
in the html link you should set correctly the target window. Try using something like this: A HREF=www.mysite.com TARGET=main_windowgo to my site/A main_window is the name of the window as assigned in the frameset declaration. cheers, A. -Messaggio originale- Da: gowthaman ramasamy [mailto:[EMAIL PROTECTED] Inviato: venerdì 14 maggio 2004 8.24 A: [EMAIL PROTECTED] Oggetto: [PHP] variable passing using URL hello list, I have a problem in passing variables using URLs. I have a link from a PHP 'Page One' and passing some variables thru URL. This link should now open another page (main frame) which will have two frames in it (left frame and Right frame). But I want the variables to be passed on to the left frame(one of the two frames in main frame). Can this be done some how? I apologize if this does not sound like a PHP question. Many thanks in advance. -- Ra. Gowthaman, Graduate Student, Bioinformatics Lab, Malaria Research Group, ICGEB , New Delhi. INDIA Phone: 91-9811261804 91-11-26173184; 91-11-26189360 #extn 314 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] variable passing
I have this in equip-lend-index.php and want to pass the variable $equipment back to the same page: PRINT td valign=\top\Equipment: form action=\$USERPREFIX/equip-lend-index.php\ method=\POST\ enctype=\text/plain\; PRINT input type=\radio\ name=\equipment\ value=\computer\ / Computers; PRINT input type=\radio\ name=\equipment\ value=\phone\/ Phones; PRINT input name=\Select\ value=\select\ type=\submit\ /; PRINT /formbr /; Hitting Select (submit button) doesn't pass the value of $equipment back to the page. What am I doing wrong? /M. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] variable passing
what is the code your using to try and retrieve the var.. are you using $_REQUEST['equipment']; jason Martin S [EMAIL PROTECTED] wrote: I have this in equip-lend-index.php and want to pass the variable $equipment back to the same page: PRINTtd valign=\top\Equipment: form action=\$USERPREFIX/equip-lend-index.php\ method=\POST\ enctype=\text/plain\; PRINTinput type=\radio\ name=\equipment\ value=\computer\ / Computers; PRINTinput type=\radio\ name=\equipment\ value=\phone\/ Phones; PRINTinput name=\Select\ value=\select\ type=\submit\ /; PRINT/formbr /; Hitting Select (submit button) doesn't pass the value of $equipment back to the page. What am I doing wrong? /M. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Variable passing through a form
Hi, I currently have a page divided into three areas, two of which are iframes. The user selects a component out of part 1, which decides what is shown in part 2. When something is clicked in part 2 the information updates in the second iframe, or part 3. This is all working fine through $PHP_SELF and target. I am now working in part 3 of my page which has already had variables passed to it from part 2, however when I try to make selections on this page which should update in the same area ($PHP_SELF) I am losing all the variables which were earlier passed. I have tried $REQUEST_URI also which didn't help. example: after coming from part 2 $REQUEST_URI might be test.php?var1=avar5=fvar16=d . If I then select and option on this new form and then send it to itself I lose everything that was originally there (output might then be test.php?newvar=new) The line which executes my form is (currently) form name=tick action=?php echo $REQUEST_URI; ? method=get enctype=multipart/form-data , and as I said $REQUEST_IRI does contain the variables on initial loading. I need to keep these initial variables and add the new (ie test.php?var1=avar5=fvar16=dnewvar=new) Please help! Thanks, Michael. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Variable Passing
Previously, Internaut said: Thankx for your reply, would you recommend setting the register_globals to on, would this be safe to do this? It's not any more or less safe than using the $HTTP_POST_VARS or $HTTP_GET_VARS arrays instead, but it could be less typing :-) Note that for the arrays mentioned here to work, track_vars must be on. In recent versions of PHP (4.0.1 and later, I think?) that is always the case. -dan -- If you had to identify, in one word, the reason why the human race has not achieved, and never will achieve, its full potential, that word would be meetings. -Dave Barry, 16 Things That Took Me 50 Years to Learn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Variable Passing
Hello Please could anyone tell me which part of the ini file I need to modify to allow me to pass variables from one form to another. Regards Internaut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Variable Passing
Set register_globals = On. But actually, you can use $HTTP_*_VARS[] to get the values from the form. * represent: GET, POST or COOKIE Please could anyone tell me which part of the ini file I need to modify to allow me to pass variables from one form to another. Regards Internaut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]