Alan M Dunsmuir wrote:
I have two example strings, a name - 'SMITHJ' - and a short phrase -
'Town and Country' - which together uniquely identify a record on my
database. I concatenate them with a separating '&' to create a single
string identifier for the record - 'SMITHJ&Town and Country'.
I create a Form for my user, each line containing some identifying data
from a different database record, and a 'Submit' button (labelled
'Edit') named by an identifier as created above.
When the Form is processed, I determine which record the user wishes to
edit by checking the name of the pressed 'Edit' button.
When I 'explode' this name to its two constituent parts, I discover that
somewhere along the above process, 'Town and Country' has become
'Town_and_Country'. (I am using PHP5.)
Where and why has this happened?
Should I be prepared for any further character substitutions?
Yep, as others have indicated, it's the name of the edit button that's
doing it.
It would have been better if you had submitted some code, it would be
easier. But I suspect you have one form with multiple edit buttons,
each edit button being identified by its respective record id.
One way to solve this would be to have separate forms for each entry,
each with a hidden field for the id and its own submit button. Another
one could have a single form with a single hidden field; when the user
clicks on the edit button, the hidden field is filled in with the
appropriate value through javascript, but this does require javascript
be enabled.
Probably the best way, IMHO, would be to redo your primary key on your
data. Rather than make it related to the data like you do have (a very
bad idea), have an independent field, i.e. an automatically incrementing
integer column. Then have the edit buttons with names such as edit_54,
edit_77, etc., where 54 and 77 would be the id's of your rows.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================