+ Reply to Thread
Results 1 to 6 of 6

Thread: PHP, MySQL and the Submit Button

  1. #1
    Join Date
    Sep 2009
    Posts
    3

    Default PHP, MySQL and the Submit Button

    Today I strated using the script because of the file upload features..

    Very Nice Script !!!

    Now I need to do this in a form:

    a) read count_field from mysql database table
    (when the form is opened)

    b) include count_field as hidden in form
    (This form has been filled out this number of times: count_field)

    c) when user hits "submit" on the form (only when they hit submit),
    add 1 to the count_field and write it back to database table

    so the loop can start over the next time the form is filled out, and the updated data is included in the email generated by the form

    Thank for any help or direction anybody can give me !

  2. #2
    Join Date
    Jun 2009
    Location
    Houston
    Posts
    378

    Post Re: PHP, MySQL and the Submit Button

    It would be easier to use formmail's nextnum feature. Keep in mind that nothing you do is going to be 100% accurate due to user errors in filling out the form. Otherwise, what you are asking for is a php programming exercise.

    Code:
    nextnum
    This function returns a number which increments on each form submission. You can use this value as a unique number or a sequence number. Note that it's possible for there to be gaps in the values (you can't rely on the numbers being sequential) due to user or other errors. 
    To enable this function, you must create a file on your server in which FormMail will store the next number to be returned. For instructions on how to do this, see the NEXT_NUM_FILE configuration setting. 
    You can also specify an optional padding amount and an optional base or radix for the number returned. The format is: 
    nextnum(pad;base) 
    Both pad and base are optional, but if you want to use base, you must also specify pad. The padding value ensures you get no less than that many digits padded on the left with zeroes. 
    <input type="hidden" name="derive_fields" value="
      order_num=%nextnum%,
      file_num=%nextnum(6)%,
      secret_code=%nextnum(8,16)%" />

  3. #3
    Join Date
    Sep 2009
    Posts
    3

    Default Re: PHP, MySQL and the Submit Button

    Thank You, I got it working:

    realname: Larry Hyman
    city: Montreal
    province: Quebec
    postal_code: H1P 1L6
    how_to_contact: contact_by_email
    comments: test
    amount_of_times_this_form_filled_in: 1

    But the only problem I see with this is that I will only be able to track one form, what if I wanted to track ten forms?

    Thanks

  4. #4
    Join Date
    Sep 2009
    Posts
    3

    Default Re: PHP, MySQL and the Submit Button

    ohhhh... I should copy formmail.php to -> formmail2.php with a new nextnum file name and use each different formmailX.php for each form..

    Is this the easy way of doing it?

    Thanks

  5. #5
    Join Date
    Jun 2009
    Location
    Houston
    Posts
    378

    Post Re: PHP, MySQL and the Submit Button

    Yes, you would need a separate formmail.php for each form.

  6. #6
    Join Date
    Mar 2004
    Posts
    2,224

    Default Re: PHP, MySQL and the Submit Button

    or u could ask tectite to implement a next_num_file concept so ur html could specify which file to use

    then u would have one formmail that would work with many forms

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. Error when submit is clicked
    By khooyongjian in forum FormMail Subscription Support
    Replies: 5
    Last Post: 15-Nov-2004, 05:00 AM
  2. Error when submit is clicked
    By thall1908 in forum FormMail Subscription Support
    Replies: 6
    Last Post: 12-Nov-2004, 12:28 AM
  3. mysql connect
    By moreover in forum FormMail Subscription Support
    Replies: 5
    Last Post: 23-Oct-2004, 11:36 PM
  4. CPU Maxed after (maybe?) double click of submit?
    By OKUser in forum FormMail Subscription Support
    Replies: 6
    Last Post: 23-Jun-2004, 08:33 PM
  5. Redirect to my page on submit
    By insight in forum FormMail Subscription Support
    Replies: 21
    Last Post: 09-Apr-2004, 01:06 AM

Bookmarks

Posting Permissions

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