For Programmers: Free Programming Magazines  


Home > Archive > PHP Language > September 2005 > Problems with apostrophes and form fields









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Problems with apostrophes and form fields
oi

2005-09-29, 7:55 am

Hi yall

I have the following problem

A user inputs something like

Mark's Birthday

into the database through a form. This works OK

However, when the data is re-presented in a form, everything after the
apostrophe is cut off...

How can I get all of the data back into the form?

TIA

Mark


Shawn Wilson

2005-09-29, 6:56 pm

"oi" <o@fhfdjh.df> wrote in message
news:1127993456. ed032b186235bd5d92aceed97880bf70@teranew
s...
> Hi yall
>
> I have the following problem
>
> A user inputs something like
>
> Mark's Birthday
>
> into the database through a form. This works OK
>
> However, when the data is re-presented in a form, everything after the
> apostrophe is cut off...
>
> How can I get all of the data back into the form?
>
> TIA
>


Need to know a couple things...

1. Confirm that the entire piece of data is making it to the DB. Is the
database really holding [Mark's Birthday]? Does 'this works OK' really mean
it worked or that you just didn't get any errors?

2. Assuming the whole thing made it to the DB, then view the source of your
HTML when the form is rendered with missing characters. Do you see this:
<input type='text' name='name' value='Mark's Birthday'> ?

If that's all it is, then your issue is the single quotes. Change your
[value=] property to use double quotes. If you're drawing this via PHP code
then you can do this: value=\"$var\" so the quotes don't trip you up.
You'll end up with value="Mark's Birthday" which will work fine.

I see that happen most often, so we'll start there.


--
Shawn Wilson


oi

2005-09-29, 6:56 pm

Hi Shawn

Yes the data was going in properly

It was the quotes issue as you mentioned...

Thanks for your help

Mark


"Shawn Wilson" <shawnw_nospam_@_nospam_dvigroup.net> wrote in message
news:y0S_e.8432$Wl6.2338@fe05.news.easynews.com...
> "oi" <o@fhfdjh.df> wrote in message
> news:1127993456. ed032b186235bd5d92aceed97880bf70@teranew
s...
>
> Need to know a couple things...
>
> 1. Confirm that the entire piece of data is making it to the DB. Is the
> database really holding [Mark's Birthday]? Does 'this works OK' really
> mean it worked or that you just didn't get any errors?
>
> 2. Assuming the whole thing made it to the DB, then view the source of
> your HTML when the form is rendered with missing characters. Do you see
> this: <input type='text' name='name' value='Mark's Birthday'> ?
>
> If that's all it is, then your issue is the single quotes. Change your
> [value=] property to use double quotes. If you're drawing this via PHP
> code then you can do this: value=\"$var\" so the quotes don't trip you
> up. You'll end up with value="Mark's Birthday" which will work fine.
>
> I see that happen most often, so we'll start there.
>
>
> --
> Shawn Wilson
>



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2009 codecomments.com