RE: [PHP] character ' in switch
| From: | David Russell | Date: | Thu, 21 Nov 2002 12:16:48 +0000 |
| Subject: | RE: [PHP] character ' in switch | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-125406@lists.php.net to get a copy of this message | ||
Hi Martin,
Just a thought - can't you escape it?
switch ($_GET['action']) {
case "about":
code
break;
case "what\'s new": <-- i want this...
code
break;
default:
break;
}
You would definitely need to put it into quotes (as I have above)
For newer versions of PHP, you would also want register globals off, and
thus you would probably want to use $_GET['action'] as I have above. If
you are using OLD PHP, then use HTTP_GET_VARS instead.
David Russell
IT Support Manager
Barloworld Optimus (Pty) Ltd
Tel: +2711 444-7250
Fax: +2711 444-7256
e-mail: DavidR@BarloworldOptimus.com
web: www.BarloworldOptimus.com
-----Original Message-----
From: Martin Hudec [mailto:corwin@corwin.sk]
Sent: 21 November 2002 02:11 PM
To: PHP
Subject: [PHP] character ' in switch
Hello all,
I would like to know how can I put ' character to case in switch...
Situation:
from flash i am getting url: index.php?action=what's new
i need to pass this thing to switch like:
switch ($action) {
case about:
code
break;
case what's new: <-- i want this...
code
break;
default:
break;
}
but PHP can't use '....i am thinking about making urlencode() to put
that character to %XX value....
any advices?
--
Best regards,
Martin mailto:corwin@corwin.sk
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Attachment: [application/x-pkcs7-signature] smime.p7s
Attachment: [application/x-pkcs7-signature] smime.p7s