Jk
|
| Posted: 03/15/2002, 7:14 AM |
|
I got this working, but I don't know if I am doing it "right"
PHP is the language
I want a field value put in the database each time someone submits a form.
Intially I put $fld<fieldname>="whatever"; in the "Before Insert" event.
The field value would not populate.
I finally relented and decided to do it with a hidden form field, so I added
<fieldname> as a hidden field to the form. I generated the page and it
worked. Then I viewed the page source so I could see my treasured field
value displayed to hackers everywhere. It wasn't there!!!
I realized that since I had customized the HTML template and told code
charge not to regenerate it, that it was never added to the form. I still
needed to keep my "Before Insert" code in place since the form does not set
the value.
This works great for me, however, is this the best way to do this?
Why can't I succuessfully set a field value that isn't in the form
configuration. I was under the impression that the form configuration was
purely for setting up the HTML form - what else is it doing.
Any defogging of my brain is appreciated,
D.
--
__________________________
Darwin Sanoy
Principal Consultant
|
|
|
 |
Glenn Holden
|
| Posted: 03/15/2002, 1:31 PM |
|
CodeCharge doesn't know that the new variable, $fld<name>, is a field (since
it didn't create it with a corresponding field). It also doesn't know that
it should be included in the form generated SQL for doing updates, etc.
There are other ways to do this but I think what you did is just fine.
You can also access and modify a variable called $sSQL in the Before Insert
event. It contains CodeCharge's generated SQL for the form insert.
Glenn
"Jk" <J@k.com> wrote in messagenews:a6t33r$16n$1@news.codecharge.com...
> I got this working, but I don't know if I am doing it "right"
>
> PHP is the language
>
> I want a field value put in the database each time someone submits a form.
>
> Intially I put $fld<fieldname>="whatever"; in the "Before Insert" event.
> The field value would not populate.
>
> I finally relented and decided to do it with a hidden form field, so I
added
> <fieldname> as a hidden field to the form. I generated the page and it
> worked. Then I viewed the page source so I could see my treasured field
> value displayed to hackers everywhere. It wasn't there!!!
>
> I realized that since I had customized the HTML template and told code
> charge not to regenerate it, that it was never added to the form. I still
> needed to keep my "Before Insert" code in place since the form does not
set
> the value.
>
> This works great for me, however, is this the best way to do this?
>
> Why can't I succuessfully set a field value that isn't in the form
> configuration. I was under the impression that the form configuration was
> purely for setting up the HTML form - what else is it doing.
>
> Any defogging of my brain is appreciated,
> D.
>
> --
> __________________________
> Darwin Sanoy
> Principal Consultant
>
>
>
|
|
|
 |
|