Re: [PHP] Question on query string
On November 16, 2004 09:06, Stuart Felenstein wrote: Why is each value preceeded by the %5B%5D ? I think the % is for wildcards, but for the life of me can't figure out what 5B and 5D stand for. Ind%5B%5D=2Ind%5B%5D=3Ind%5B%5D=4Ind%5B%5D=5.. Stuart, The % is an escape character to let the browser know that the character isn't allowed in a URL. The browser then looks at the next 2 characters as a hex code for the ASCII character which should be there. So for %5B, it really is '[', and %5D really is ']'. You can see what all the ASCII codes are here: http://www.asciitable.com/ HTH -- Regards, David Bevan We could learn a lot from crayons: some are sharp, some are pretty, some are dull, some have weird names, and all are different colorsbut they all exist very nicely in the same box. http://www.getanyideas.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question on query string
Hello Stuart, Tuesday, November 16, 2004, 2:06:03 PM, you wrote: SF Why is each value preceeded by the %5B%5D ? I think the % is for SF wildcards, but for the life of me can't figure out what 5B and 5D SF stand for. SF Ind%5B%5D=2Ind%5B%5D=3Ind%5B%5D=4Ind%5B%5D=5.. They're hex values. Use urldecode() to get them back to normal again. Best regards, Richard Davey -- http://www.launchcode.co.uk - PHP Development Services I am not young enough to know everything. - Oscar Wilde -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question on query string
--- Richard Davey [EMAIL PROTECTED] wrote: Use urldecode() to get them back to normal again. Changed the form action line to this: action=searchresults.php?Ind=?php echo urldecode(((isset($_POST[Ind[]]))?$_POST[Ind[]]:)) Still getting this: ?Ind%5B%5D=1Ind%5B%5D=2Ind%5B%5D=3 I'm under the assumption the values get passed from search.php using urldecode() to searchresults.php. Maybe that is not the case. Or should I do a $_GET['Ind'] = urlencode('Ind') on searchresults.php ? Stuart -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Question on query string
Stuart Felenstein mailto:[EMAIL PROTECTED] on Tuesday, November 16, 2004 8:28 AM said: --- Richard Davey [EMAIL PROTECTED] wrote: Use urldecode() to get them back to normal again. [snip] Or should I do a $_GET['Ind'] = urlencode('Ind') on searchresults.php ? ?php // this is what he means. $Ind = urldecode($_GET['Ind']); ? hth, chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question on query string
On Wednesday 17 November 2004 00:28, Stuart Felenstein wrote: --- Richard Davey [EMAIL PROTECTED] wrote: Use urldecode() to get them back to normal again. Changed the form action line to this: action=searchresults.php?Ind=?php echo urldecode(((isset($_POST[Ind[]]))?$_POST[Ind[]]:)) When you're building a query string then (in general) there is no need for urldecode(). On the contrary you want to use urlencode(), this is done on the *value* of the individual parameters. And about this: $_POST[Ind[]], it's obvious you haven't absorbed what I said about this particular construct. Please re-read my previous post regarding this and try to understand it. Or should I do a $_GET['Ind'] = urlencode('Ind') on searchresults.php ? If the URL on the searchpage was constructed properly then on searchresults.php the values passed can be read from $_GET directly with no further processing (ie no need for urldecode() and other such nonsese) on your part. But remember, you still need to validate the data you get from $_GET (and in general from $_POST etc) before you use them. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* Unix soit qui mal y pense [Unix to him who evil thinks?] */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Question on query string
To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm On 16 November 2004 16:28, Stuart Felenstein wrote: --- Richard Davey [EMAIL PROTECTED] wrote: Use urldecode() to get them back to normal again. Changed the form action line to this: action=searchresults.php?Ind=?php echo urldecode(((isset($_POST[Ind[]]))?$_POST[Ind[]]:)) Still getting this: ?Ind%5B%5D=1Ind%5B%5D=2Ind%5B%5D=3 I'm under the assumption the values get passed from search.php using urldecode() to searchresults.php. Maybe that is not the case. URL encoding and decoding is done completely outwith PHP in this case -- the encoding to %xx is done by the browser, and automatically decoded by the Web server on the way through to PHP. You should never see the %xx versions in your script, and will have no need of urldecode(). The main problem with the above snippet that I can see is that there's very unlikely to be such a thing as $_POST[Ind[]] -- form fields with name=Ind[] will turn up as an array in $_POST[Ind] ($_POST[Ind][0], $_POST[Ind][1], etc.). But the whole snippet looks very odd -- why are you trying to pass POSTed values as GET variables on (I presume) a form action?? Can you post a little context to the list to give us some idea what you're really trying to do. Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Headingley Campus, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Question on query string
--- Ford, Mike [EMAIL PROTECTED] wrote: The main problem with the above snippet that I can see is that there's very unlikely to be such a thing as $_POST[Ind[]] -- form fields with name=Ind[] will turn up as an array in $_POST[Ind] ($_POST[Ind][0], $_POST[Ind][1], etc.). But the whole snippet looks very odd -- why are you trying to pass POSTed values as GET variables on (I presume) a form action?? Can you post a little context to the list to give us some idea what you're really trying to do. Mike - Not sure what context would be useful. The form action is set to $_GET method. I should have noticed POST in there but set those urldecodes via Dreamweaver bindings. If you know what those are. Originally the form was $_POST. Now - method=get The search.php form really does nothing with the arrays. In searchresults.php I am grabbing the variables like this: $HTTP_GET_VARS['Ind'] if (count($Ind) 0 AND is_array($Ind)) { $s_Ind = '.implode(',', $Ind).'; Stuart -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question on query string
--- Jason Wong [EMAIL PROTECTED] wrote: When you're building a query string then (in general) there is no need for urldecode(). On the contrary you want to use urlencode(), this is done on the *value* of the individual parameters. And about this: $_POST[Ind[]], it's obvious you haven't absorbed what I said about this particular construct. Please re-read my previous post regarding this and try to understand it. If the URL on the searchpage was constructed properly then on searchresults.php the values passed can be read from $_GET directly with no further processing (ie no need for urldecode() and other such nonsese) on your part. But remember, you still need to validate the data you get from $_GET (and in general from $_POST etc) before you use them. Sorry, for some reason my email is out of synch today. First the searchresults.php is reading the values properly. The queries are running correct-all fields. I'm still printing out the sql statement and those are without the hex values. The method is $_GET , search.php is nothing more then some form elements and fields. For searchresults.php (right below) is the way I'm grabbing everything: $HTTP_GET_VARS['Ind']; // check any item is selected if (count($Ind) 0 AND is_array($Ind)) { $s_Ind = '.implode(',', $Ind).'; } $HTTP_GET_VARS['State']; // check any item is selected if (count($State) 0 AND is_array($State)) { $s_State = '.implode(',', $State).'; } $HTTP_GET_VARS['TType']; // check any item is selected if (count($TType) 0 AND is_array($TType)) { $s_TType = '.implode(',', $TType).'; } //Textfields / Dropdown $HTTP_GET_VARS['JTitle']; $HTTP_GET_VARS['City']; $HTTP_GET_VARS['Days']; I'm not seeing what is incorrect. I did try $HTTP_GET_VARS['Ind'] = urldecode('Ind'); (in searchresults.php) but of course it wasn't imploded yet. I don't want to confuse this question or myself (or anyone) , but maybe I should do the implodes on search.php ? Stuart -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Question on query string
To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm -Original Message- From: Stuart Felenstein To: [EMAIL PROTECTED] Sent: 16/11/04 21:35 Subject: Re: [PHP] Question on query string For searchresults.php (right below) is the way I'm grabbing everything: $HTTP_GET_VARS['Ind']; This does nothing. Nada. Zippo. (Except waste time.) What do you believe it does? // check any item is selected if (count($Ind) 0 AND is_array($Ind)) { $s_Ind = '.implode(',', $Ind).'; } $HTTP_GET_VARS['State']; Ditto. // check any item is selected if (count($State) 0 AND is_array($State)) { $s_State = '.implode(',', $State).'; } $HTTP_GET_VARS['TType']; Likewise. // check any item is selected if (count($TType) 0 AND is_array($TType)) { $s_TType = '.implode(',', $TType).'; } //Textfields / Dropdown $HTTP_GET_VARS['JTitle']; $HTTP_GET_VARS['City']; $HTTP_GET_VARS['Days']; And thrice ditto. Cheers! Mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Question on query string
--- Chris W. Parker [EMAIL PROTECTED] wrote: Did you purposefully ignore my previous email??? Someone else I think mentioned this in another email in this thread also. Why are you assigning anything to $HTTP_GET_VARS at all? It's meant to retrieve data. // (again) this is how you use urldecode() $Ind = urldecode($_GET['Ind']); Chris I did not ignore your email I tried using that code. A warning came back that urldecode was expecting a string not an array. This is why I posted the followup wondering if I should impode the array and then assign the urldecode. Stuart -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Question on query string
--- Ford, Mike [EMAIL PROTECTED] wrote: //Textfields / Dropdown $HTTP_GET_VARS['JTitle']; $HTTP_GET_VARS['City']; $HTTP_GET_VARS['Days']; And thrice ditto. They looked good, gone now :) Stuart -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Question on query string
Stuart Felenstein mailto:[EMAIL PROTECTED] on Tuesday, November 16, 2004 1:35 PM said: I'm not seeing what is incorrect. I did try $HTTP_GET_VARS['Ind'] = urldecode('Ind'); (in searchresults.php) but of course it wasn't imploded yet. I don't want to confuse this question or myself (or anyone) , but maybe I should do the implodes on search.php ? Did you purposefully ignore my previous email??? Someone else I think mentioned this in another email in this thread also. Why are you assigning anything to $HTTP_GET_VARS at all? It's meant to retrieve data. // (again) this is how you use urldecode() $Ind = urldecode($_GET['Ind']); Chris. p.s. i think your keyboard may be broken. there always seems to be a space in front of your commas, question marks, and exclamation points. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Question on query string
I think maybe $jtitle=$HTTP_GET_VARS['JTitle']; -- Jason Oakley Robina Helpdesk AAPT Limited Ph: 07 5562 4359 [EMAIL PROTECTED] -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] ]On Behalf Of Stuart Felenstein Sent: Wednesday, 17 November 2004 9:38 AM To: Ford, Mike; '[EMAIL PROTECTED] ' Subject: RE: [PHP] Question on query string --- Ford, Mike [EMAIL PROTECTED] wrote: //Textfields / Dropdown $HTTP_GET_VARS['JTitle']; $HTTP_GET_VARS['City']; $HTTP_GET_VARS['Days']; And thrice ditto. They looked good, gone now :) Stuart -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- This communication, including any attachments, is confidential. If you are not the intended recipient, you should not read it - please contact me immediately, destroy it, and do not copy or use any part of this communication or disclose anything about it. -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Question on query string
On Tue, 2004-11-16 at 20:24, Robby Russell wrote: On Wed, 2004-11-17 at 11:28 +1100, Jason Oakley wrote: I think maybe $jtitle=$HTTP_GET_VARS['JTitle']; Might I remind you that $_HTTP_*_VARS is deprecated.. $_GET $_POST (it's also much quicker to type) And not as backward compatible. Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Question on query string
On Wed, 2004-11-17 at 11:28 +1100, Jason Oakley wrote: I think maybe $jtitle=$HTTP_GET_VARS['JTitle']; Might I remind you that $_HTTP_*_VARS is deprecated.. $_GET $_POST (it's also much quicker to type) -Robby -- /*** * Robby Russell | Owner.Developer.Geek * PLANET ARGON | www.planetargon.com * Portland, OR | [EMAIL PROTECTED] * 503.351.4730 | blog.planetargon.com * PHP/PostgreSQL Hosting Development *--- Now supporting PHP5 --- / signature.asc Description: This is a digitally signed message part