Re: [PHP] Double quotes in form fields and submitting them

2002-03-23 Thread Miguel Cruz

On Fri, 22 Mar 2002, webapprentice wrote:
 I have a form with a text field, say userName.
 I put a value in that has double quotes (i.e. foobar) and submit this form.
 
 On output I have this:
 ?php echo $HTTP_POST_VARS[userName]; ?
 
 The output ends up being a \.

The quotes go away, or they just get a backslash before them? If the 
latter, try ?= stripslashes($HTTP_POST_VARS['userName']) ?

miguel


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Double quotes in form fields and submitting them

2002-03-23 Thread webapprentice

Hi,
foobar becomes simply \

I've lost foobar AND the double quotes.  Is there a way to keep them all?

--Stephen

- Original Message -
From: Miguel Cruz [EMAIL PROTECTED]
To: webapprentice [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Saturday, March 23, 2002 7:49 PM
Subject: Re: [PHP] Double quotes in form fields and submitting them


 On Fri, 22 Mar 2002, webapprentice wrote:
  I have a form with a text field, say userName.
  I put a value in that has double quotes (i.e. foobar) and submit this
form.
 
  On output I have this:
  ?php echo $HTTP_POST_VARS[userName]; ?
 
  The output ends up being a \.

 The quotes go away, or they just get a backslash before them? If the
 latter, try ?= stripslashes($HTTP_POST_VARS['userName']) ?

 miguel



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Double quotes in form fields and submitting them

2002-03-23 Thread Miguel Cruz

That's a little odd; something else must be going on. Can you provide some 
more code, and, preferably, a pointer to a live example?

miguel

On Sat, 23 Mar 2002, webapprentice wrote:

 Hi,
 foobar becomes simply \
 
 I've lost foobar AND the double quotes.  Is there a way to keep them all?
 
 --Stephen
 
 - Original Message -
 From: Miguel Cruz [EMAIL PROTECTED]
 To: webapprentice [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Sent: Saturday, March 23, 2002 7:49 PM
 Subject: Re: [PHP] Double quotes in form fields and submitting them
 
 
  On Fri, 22 Mar 2002, webapprentice wrote:
   I have a form with a text field, say userName.
   I put a value in that has double quotes (i.e. foobar) and submit this
 form.
  
   On output I have this:
   ?php echo $HTTP_POST_VARS[userName]; ?
  
   The output ends up being a \.
 
  The quotes go away, or they just get a backslash before them? If the
  latter, try ?= stripslashes($HTTP_POST_VARS['userName']) ?
 
  miguel
 
 
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] The infamous HTML quotes Re: [PHP] Double quotes in form fields and submitting them

2002-03-23 Thread webapprentice

Sorry Miguel, it's the HTML entities nonsense again.
It displayed as \ on my browser, but the HTML source code indicated
otherwise.

Thus, if I entered foobar, it shows up as \ but the HTML source shows.

input type=text name=realName value=\foobar\

So value=\ was the culprit, so you're original solution was in the right
direction.  stripslashes() itself wouldn't work because the HTML source
would be value=foobar and on in HTML, only the first two double quotes
count.

The solution was this, which apparently has been discussed many times
before.

stripslashes(htmlentities($HTTP_POST_VARS[realName]));
or
stripslashes(htmlspecialcharacters($HTTP_POST_VARS[realName]));

Thanks for your help in leading me to the right direction.


- Original Message -
From: Miguel Cruz [EMAIL PROTECTED]
To: webapprentice [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Saturday, March 23, 2002 8:03 PM
Subject: Re: [PHP] Double quotes in form fields and submitting them


 That's a little odd; something else must be going on. Can you provide some
 more code, and, preferably, a pointer to a live example?

 miguel

 On Sat, 23 Mar 2002, webapprentice wrote:

  Hi,
  foobar becomes simply \
 
  I've lost foobar AND the double quotes.  Is there a way to keep them
all?
 
  --Stephen
 
  - Original Message -
  From: Miguel Cruz [EMAIL PROTECTED]
  To: webapprentice [EMAIL PROTECTED]
  Cc: [EMAIL PROTECTED]
  Sent: Saturday, March 23, 2002 7:49 PM
  Subject: Re: [PHP] Double quotes in form fields and submitting them
 
 
   On Fri, 22 Mar 2002, webapprentice wrote:
I have a form with a text field, say userName.
I put a value in that has double quotes (i.e. foobar) and submit
this
  form.
   
On output I have this:
?php echo $HTTP_POST_VARS[userName]; ?
   
The output ends up being a \.
  
   The quotes go away, or they just get a backslash before them? If the
   latter, try ?= stripslashes($HTTP_POST_VARS['userName']) ?
  
   miguel
  
 
 




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php