[PHP] Escaping double quotes
So I'm writing this page (PHP Newbie here) and it checks to see if a var is set, if it isn't it spits out the form info like so: echo form action=myform.php method=post; Now is there a way to 'wrap' that so I don't have to escape quotes? Something like perls 'qq' function is what I'm looking for. I tried a few different functions from the website, magic_quotes, addslashes, htmlspecial etc etc but none did what I was looking for Jeremy Pavleck Network Engineer - Systems Management IT Networks and Infrastructure Direct Line: 612-977-5881 Toll Free: 1-888-CAPELLA ext. 5881 Fax: 612-977-5053 E-mail: [EMAIL PROTECTED] Capella University 225 South 6th Street, 9th Floor Minneapolis, MN 55402 www.capella.edu -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Escaping double quotes
On 25/05/06, Pavleck, Jeremy D. [EMAIL PROTECTED] wrote: So I'm writing this page (PHP Newbie here) and it checks to see if a var is set, if it isn't it spits out the form info like so: echo form action=myform.php method=post; Now is there a way to 'wrap' that so I don't have to escape quotes? Something like perls 'qq' function is what I'm looking for. I tried a few different functions from the website, magic_quotes, addslashes, htmlspecial etc etc but none did what I was looking for You know you can switch the php parser on and off like so: ?php if (isset($var)) { ? form action=myform.php method=post ?php } ? which is a bit more efficient and better than all those echo statements and escapes? -- http://www.web-buddha.co.uk dynamic web programming from Reigate, Surrey UK (php, mysql, xhtml, css) look out for project karma, our new venture, coming soon!
Re: [PHP] Escaping double quotes
So I'm writing this page (PHP Newbie here) and it checks to see if a var is set, if it isn't it spits out the form info like so: echo form action=myform.php method=post; Now is there a way to 'wrap' that so I don't have to escape quotes? Something like perls 'qq' function is what I'm looking for. I tried a few different functions from the website, magic_quotes, addslashes, htmlspecial etc etc but none did what I was looking for Jeremy Pavleck Network Engineer - Systems Management IT Networks and Infrastructure Direct Line: 612-977-5881 Toll Free: 1-888-CAPELLA ext. 5881 Fax: 612-977-5053 E-mail: [EMAIL PROTECTED] Capella University 225 South 6th Street, 9th Floor Minneapolis, MN 55402 www.capella.edu I believe you can just use single qiote for this example of yours. echo 'form action=myform.php method=post'; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Escaping double quotes
Pavleck, Jeremy D. wrote: So I'm writing this page (PHP Newbie here) and it checks to see if a var is set, if it isn't it spits out the form info like so: echo form action=myform.php method=post; Now is there a way to 'wrap' that so I don't have to escape quotes? Something like perls 'qq' function is what I'm looking for. I tried a few different functions from the website, magic_quotes, addslashes, htmlspecial etc etc but none did what I was looking for http://us2.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Escaping double quotes
or heredeoc syntax :) On 5/25/06, John Nichel [EMAIL PROTECTED] wrote: Pavleck, Jeremy D. wrote: So I'm writing this page (PHP Newbie here) and it checks to see if a var is set, if it isn't it spits out the form info like so: echo form action=myform.php method=post; Now is there a way to 'wrap' that so I don't have to escape quotes? Something like perls 'qq' function is what I'm looking for. I tried a few different functions from the website, magic_quotes, addslashes, htmlspecial etc etc but none did what I was looking for http://us2.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Mindaugas
Re: [PHP] Escaping double quotes
Not sure I understand your question correctly. I think you can just use soemthing like: echo 'form action=myform.php method=post'; Mindaugas L wrote: or heredeoc syntax :) On 5/25/06, John Nichel [EMAIL PROTECTED] wrote: Pavleck, Jeremy D. wrote: So I'm writing this page (PHP Newbie here) and it checks to see if a var is set, if it isn't it spits out the form info like so: echo form action=myform.php method=post; Now is there a way to 'wrap' that so I don't have to escape quotes? Something like perls 'qq' function is what I'm looking for. I tried a few different functions from the website, magic_quotes, addslashes, htmlspecial etc etc but none did what I was looking for http://us2.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- 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] Escaping double quotes?
How do you escape double quotes? I have the following which is supposed to make any " in a string into \" but it doesn't seem to work. What's wrong with it? $tmp_string = str_replace ("\"", "\\\"", $tmp_string); -Ben -- 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] Escaping double quotes?
addslashes() usually works for me... --Joe On Sun, Feb 25, 2001 at 01:46:30AM -0500, Ben Cheng wrote: How do you escape double quotes? I have the following which is supposed to make any " in a string into \" but it doesn't seem to work. What's wrong with it? $tmp_string = str_replace ("\"", "\\\"", $tmp_string); -Ben -- 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] -- --- Joe Stump, PHP Hacker, [EMAIL PROTECTED] -o) http://www.miester.org http://www.care2.com /\\ "It's not enough to succeed. Everyone else must fail" -- Larry Ellison _\_V --- -- 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]