Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2010
    Posts
    10
    Plugin Contributions
    0

    Default Help: Creating Simple Form to Post to New DB Table

    I've toyed with the code long enough now I suppose I'll ask for a little help. I'm wanting to create a simple form on each product page, article page, a tutorial page on my site. The form data (which has been placed into hidden inputs with set values) needs to be posted to a new DB table which I have created.

    I have the form completed and action set to 'process.php' which contains the INSERT query for the DB table. However, when I attempt to insert it says that either I don't have access/permission.

    So what I am asking is this. Is there anyone out there can give a straight forward example to

    A) the required file locations (perhaps i haven't placed the process.php in the right location)

    B)outline the zen cart queries I should be using with a brief explanation (ex: does global $db; connect me to my zen cart DB or do I still need a mysql_select_db statement?)

    This should be a very simple task for me to accomplish. The code needed is NOT complex at all but for whatever reason zen cart is determined not to make anything simple.

    :etails::

    new database table has 3 fields.
    1) favorite_id (int 11 ,auto increment)
    2) customers_id (int 11)
    3) page_url VARCHAR (255)

    customers_id value is $_SESSION['customer_id']
    page_url value is pretty self explanatory

    I have almost punched my screen on numerous occassions and I'm hoping someone out there can save my sanity and give me a shove in the right direction.

    Also, if anyone knows of any tutorials on programming for zen cart mods I would appreciate it. (I've looked through the wiki, and API but I guess I'm either missing something or it's just that helpful)

    Thank you.

  2. #2
    Join Date
    May 2005
    Location
    Bath, Somerset
    Posts
    1,053
    Plugin Contributions
    3

    Default Re: Help: Creating Simple Form to Post to New DB Table

    The quickest way to acheive what you're looking for is:

    Code:
    zen_db_perform('TABLE_NAME_HERE',
                            array('customers_id'  =>  (int)$_SESSION['customer_id'],
                                     'page_url'  =>  $YOUR_PAGE_VARIALBE_HERE));
    This will insert directly into the table named TABLE_NAME_HERE.

    There aren't really any tutorials on programming for Zen. I would suggest you get a good book on PHP, and then just start looking through the classes and functions folders, as this is where much of the stock Zen code is hidden.

    Absolute
    Back, after a 4 year absence! Did you miss me?
    Absolute Web Solutions Ltd
    Interested in our work? Take a look at one of our sites - The Tech Store

  3. #3
    Join Date
    Aug 2010
    Posts
    10
    Plugin Contributions
    0

    Default Re: Help: Creating Simple Form to Post to New DB Table

    Thank you very much Absolute for your prompt response. I've recently got my hands on some PHP books to help me get started actually. Your response is much appreciated, my sanity thanks you =)

 

 

Similar Threads

  1. v150 Help creating distributor application form
    By dfontana in forum General Questions
    Replies: 8
    Last Post: 22 Sep 2012, 06:36 PM
  2. Creating a Form to Help Customers Choose Products
    By srturner47 in forum General Questions
    Replies: 5
    Last Post: 13 Feb 2008, 02:46 AM
  3. Replies: 3
    Last Post: 16 Nov 2006, 07:53 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg