WordPress.org

Ready to get started?Download WordPress

Forums

Fast Secure Contact Form
echo php variable in hidden field (12 posts)

  1. ombre8
    Member
    Posted 3 years ago #

    Hi there,

    I would like to include a Code into a hidden field so that it get send to the admin and is saved in the DB (using Contact Form to DB Extension). But i can't figure out how to include a variable into the hiddenfield...

    Code,<?php echo $the_code; ?> isn't working... is there a easy way to do something like that? I don't care if I have to change something in the source, to make it work...

    greets

    http://wordpress.org/extend/plugins/si-contact-form/

  2. Mike Challis
    Member
    Plugin Author

    Posted 3 years ago #

    Tell me more about why you need that, then maybe I can suggest something.

    Mike

  3. ombre8
    Member
    Posted 3 years ago #

    I would like to use the plugin as an order form for tickets for a festival. The Code is needed to identify the buyer. the simpelst way to get it into the DB and the Mail is by using a hidden field (i think), in which i enter the variable...

    thanks for your help!

  4. Mike Challis
    Member
    Plugin Author

    Posted 3 years ago #

    You can do this if it meets your needs:

    Add a extra hidden field to the form, then use the query string URL feature to set it dynamically.

    ht tp://www.yoursite.com/test_form?1ex_field1=2222

    [form number]ex_field[field number]=[string]
    Example: form 1 using extra field 1 for hidden field:
    &1ex_field1=2222

    I just had to add hidden to be allowed on the query, so if you want to use it, you have to upgrade first:
    http://www.fastsecurecontactform.com/update-to-the-latest

    Can you use this?

  5. ombre8
    Member
    Posted 3 years ago #

    Hi Mike,

    thanks for your Help, I don't really get it at the Moment, how do i get this string to get dynamically?

    Thank you very much

    lukas

  6. Mike Challis
    Member
    Plugin Author

    Posted 3 years ago #

    Tell me more about your "Code needed to identify the buyer".
    Where does that come from?

    Mike

  7. ombre8
    Member
    Posted 3 years ago #

    thats a rand() number + the time stamp, the buyer tells us the number (he will get when he order) when he pays and so that we know what he orderd... (it doesn't work over names or something because of our great bank system)

  8. zorbs
    Member
    Posted 3 years ago #

    Same request as per ombre8 here.

    This is used as a front-end to a payment order form. My system needs to generate order numbers automatically.

    I have a function that generates (algorithmically) an order number using Unix timestamp as a seed. I need to pass this value to a 3rd party URL, through your "Query string key value pairs to add:":

    order_no={PHP HERE}

    It would be nice if this would be compatible with "Shortcode Exec PHP" plugin, which allows me to easily define my PHP function and then call it from anywhere with a custom-defined shortcode. I would then be able to create my order-generation as a shortcode (say "make_orderNo"], and call it from your field "Query string key value pairs to add:":

    order_no=[make_orderNo]

    Another idea, which is self-sustained, and wouldn't make your plug in depended on anything else, you could program a new field type, i.e. "Dynamic", and you allow form developers to choose from a list of constructors, which would generate dynamic data on-the-fly. For example, "the right X digits from a timestamp", or "a random number with X digits, ranged from Y to Z", plus configurable header or trailer.

    I would then have a hidden, dynamic field, which I would then rename and pass along to the 3rd party url.

    Under a worst-case scenario, where in your php code should I insert a conditional statement, looking for something unique on that form (i.e. the form number), and then define my dynamic field manually?

    Thank you for your great plugin!

  9. zorbs
    Member
    Posted 3 years ago #

    Notwithstanding - of course - the already-available option of submitting the form to an intermediary PHP script, which adds the dynamically-generated new field, prior to sending to the final destination...

  10. Mike Challis
    Member
    Plugin Author

    Posted 3 years ago #

    zorbs,

    Currently there is no random or incremental field option. I have it on a to do list for future updates.
    Maybe you could set a optional hidden field with shortcode and put your php generated order # in there?
    http://www.fastsecurecontactform.com/shortcode-options

    Mike

  11. zorbs
    Member
    Posted 3 years ago #

    Hmm, haven't tested this, but it may work:
    [si-contact-form form='1' hidden='account=[PHP shortcode here]']

    I have solved my issue by posting to another page, then adding my auto code then sending further to the final destination.

    Thanks,

  12. Jup1898
    Member
    Posted 2 years ago #

    This thread seems to be related to what I'd like to do with one of my sites. I am passing the keyword from Google AdWords through to the landing page URL and the landing page has additional PHP code to get the kw from the URL and store it as a PHP variable called '$kw'

    I'd like to insert '$kw' as the default value of a hidden field. What do I need to type in the default text box in my form? (sorry if I'm doing this posting wrong - this is my first comment/question ever :( )

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic