Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Insert Record with Non Form Value

New Here ,
Oct 02, 2008 Oct 02, 2008
I'm using the insert record function to insert into a MySQL DB and DW is only letting me add fields and values that are from form items. I'd like to be able to insert variable values that aren't contained in a form. I don't want to include it in a hidden form field because the data is sensitive and I don't want it shown in the source code. I'm programming in PHP and the PHP and SQL code that DW inserts is pretty complex and over my head since it includes checks against SQL injection attacks.

Does anyone know how to tweak the code or of a work around that doesn't involve tweaking the code in order to insert values that aren't from form fields?
TOPICS
Server side applications
441
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 02, 2008 Oct 02, 2008
EasyEer wrote:
> I'm using the insert record function to insert into a MySQL DB and DW is only
> letting me add fields and values that are from form items. I'd like to be able
> to insert variable values that aren't contained in a form. I don't want to
> include it in a hidden form field because the data is sensitive and I don't
> want it shown in the source code. I'm programming in PHP and the code that DW
> inserts is really complex compared to what I am used to when inserting records.
>
> Does anyone know how to tweak the code or of a work around that doesn't
> involve tweaking the code in order to insert values that aren't from form
> fields? I could write my own insert record code but I'd like to keep the
> existing DW code if possible.
>
A variable like what?
Mick
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 03, 2008 Oct 03, 2008
EasyEer wrote:
> I'm using the insert record function to insert into a MySQL DB and DW is only
> letting me add fields and values that are from form items. I'd like to be able
> to insert variable values that aren't contained in a form. I don't want to
> include it in a hidden form field because the data is sensitive and I don't
> want it shown in the source code. I'm programming in PHP and the code that DW
> inserts is really complex compared to what I am used to when inserting records.
>
> Does anyone know how to tweak the code or of a work around that doesn't
> involve tweaking the code in order to insert values that aren't from form
> fields? I could write my own insert record code but I'd like to keep the
> existing DW code if possible.

In the Application panel find the Bindings tab. Click the plus button
and select the kind of variable, I am guessing you want an application
variable, then you can use that binding on your insert form instead of
the form binding.

Dooza

--
Posting Guidelines
http://www.adobe.com/support/forums/guidelines.html
How To Ask Smart Questions
http://www.catb.org/esr/faqs/smart-questions.html
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 17, 2008 Oct 17, 2008
Thanks for the responses. I created different variable types using the bindings tab but when inserting a database record they did not show up as options to pull from, instead there was only the form fields. Fortunately I was able to play around with the code and get the variable to insert along with the form data.

What I was trying to do is have a administrative user add a new user. The admin user will supply the email address of the new user and a couple other fields into a form. A random temporary password is then generated, this is the variable that I am referring to which I didn't want placed in a hidden field. The data will then be added as a new record to the database and the new user will be emailed the temporary password.

Do you know of a quick and easy way to do this in DW without the need to modify code?

I am coding in PHP, it's my understanding that PHP does not support application variables. How can I create a variable in DW that is only specific to my page?
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 17, 2008 Oct 17, 2008
LATEST
EasyEer wrote:
> What I was trying to do is have a administrative user add a new user. The
> admin user will supply the email address of the new user and a couple other
> fields into a form. A random temporary password is then generated, this is the
> variable that I am referring to which I didn't want placed in a hidden field.
> The data will then be added as a new record to the database and the new user
> will be emailed the temporary password.
>
> Do you know of a quick and easy way to do this in DW without the need to
> modify code?

What you are trying to do is very easy, but it goes without saying that
you need to modify the code. Dreamweaver provides the basics for you.
After that, you need to adapt the code to your own needs.

If you don't understand the code that Dreamweaver has generated, the
easiest way to deal with this situation is to create a hidden field for
the password, but give it no value. You can then use the Insert Record
server behavior to assign the hidden field to the password column. This
builds the SQL query, using $_POST['password'] as the value.

Then adapt the insert record script to assign a value to
$_POST['password'] *after* the form has been submitted.

--
David Powers, Adobe Community Expert
Author, "The Essential Guide to Dreamweaver CS3" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines