Addform help please

8 posts by 2 authors in: Forums > CMS Builder
Last Post: April 3, 2012   (RSS)

Re: [thenetgirl] Addform help please

By (Deleted User) - March 28, 2012

Hi thenetgirl,

I think what you're asking for is to add the num of the user who created the record, which you're doing toward the bottom of your code but with one important thing to change:
//....preceding code snippet
createdByUserNum = 'num',
updatedByUserNum = 'num'")


should be

//....preceding code snippet
createdByUserNum = $CURRENT_USER['num'],
updatedByUserNum = $CURRENT_USER['num']")


The $CURRENT_USER global is where the current user information is stored - any user logged in via the website membership plugin has this array created, containing all their information.

Let me know if this helps,

Tom

Re: [Tom P] Addform help please

By thenetgirl - March 28, 2012

No that didnt work the form just disappears then.
Patricia

www.thenetgirl.com

Re: [thenetgirl] Addform help please

By thenetgirl - March 29, 2012

Do you have any suggestions?



Also I cant seem to get the drop menu - Prioirty to post to the database I attached the form. My deadline is close and I need help please.
Patricia

www.thenetgirl.com

Re: [thenetgirl] Addform help please

By thenetgirl - March 29, 2012


Patricia

www.thenetgirl.com
Attachments:

auto_addform.php 7K

Re: [thenetgirl] Addform help please

By thenetgirl - March 29, 2012

I was able to get the priority to post properly but still no user so it doesnt appear on the list in the CMS in his account.
Patricia

www.thenetgirl.com

Re: [thenetgirl] Addform help please

By thenetgirl - March 30, 2012

Finally found the right code



createdByUserNum = '".mysql_escape($CURRENT_USER['num'])."',
updatedByUserNum = '".mysql_escape($CURRENT_USER['num'])."'")
Patricia

www.thenetgirl.com

Re: [thenetgirl] Addform help please

By (Deleted User) - April 3, 2012

Hi thenetgirl,

In my code I forgot to break out of the string, hence the form disappearing altogether (the $CURRENT_USER['num'] needed to be bookended with ". and .") and, as you discovered, it's also best practice to escape any content being inserted into the database, just in case.

Glad it's all resolved!

Tom