• jamesfroud

    (@jamesfroud)


    shortcodes

    You will configure the form using shortcodes
    The available shortcodes are:

    * [db_form] – Encloses your form.
    * [input]
    * [mail]
    * [hidden]
    * [textarea]
    * [radio]
    * [select]
    * [checkbox]
    * [submit]

    Each of those shortcodes, except [db_form], can handle specific attributes. Those attributes are:

    * label
    * value
    * name
    * required

    Special attribute for [radio] and [select] is:
    * description

    label

    This will be the label which will be returned infront of input fields, behind radio buttons and checkboxes and on the submit button
    Any caption can be used.
    Default: NULL

    value

    Specify this attribute to either give input fields a standard text or to define the submit values of radio buttons and checkboxes
    Any caption can be used.
    Default: NULL

    name

    The name attribute specifies in which column in your mySQL database the value should be submitted.
    Any caption can be used.
    Default: NULL

    Important:
    The name-attribute needs to be identical with the column name in your mySQL database
    Note:
    Don’t use spaces neither within your name-attribute nor as your mySQL column name.
    This plugIn is not tested with spaces within the name-attribute.
    required

    Use this attribute to set whether the field is required or not.
    Takes only true and false as values.
    Default: false

    description

    This attribute can only be used with the [radio] and [select] shortcodes.
    It can be used to put a text in front of your radio buttons / select dropdown.
    Default: NULL

    shortcode example usage

    example 1

    Form to submit firstname, lastname and an e-mail adress.
    Firstname and e-mail are required lastname isn’t.
    E-Mail field will have the default value “[email protected]

    [db_form]
    [input label=”Firstname *” name=”sql_firstname” required=”true”]
    [input label=”Lastname” name=”sql_lastname” ]
    [mail label=”E-Mail *” value=”[email protected]” name=”sql_mail” required=”true”]
    [submit label=”Send!”]
    [/db_form]

    example 2

    Form to submit the answer to 2 questions and an e-mail adress.
    Everything is required.

    [db_form]
    [radio description=”Choose your gender. *” label=”Male;Female” value=”m;f” name=”sql_gender” required=”true”]
    [radio description=”What’s the right answer to 2+2? *” label=”3;7;4;2″ value=”3;7;4;2″ name=”sql_math” required=”true”]
    [mail label=”E-Mail *” name=”sql_mail” required=”true”]
    [submit label=”Transmit data.”]
    [/db_form]

    example 3

    Form to submit 2 text fields and the value of a checkbox.
    Only the checkbox is required.

    [db_form]
    [input label=”Your location” name=”sql_location”]
    [input label=”Your destination” name=”sql_destination”]
    [checkbox label=”I’d love to use your plugIn” value=”yes” name=”sql_use” required=”true”]
    [submit label=”Submit my choice.”]
    [/db_form]

    Note:
    The checkbox-shortcode can also work as an enclosing element. That’s especially useful whenever you want to use a lot of code or even HTML markup behind your checkbox.
    [checkbox value=”yes” name=”sql_use” required=”true”]I’d love to use your plugIn[/checkbox]

    mail message examples

    You can set up custom mail and mail confirmation messages including the values submitted by the frontend-user.
    To do so you have to use the field’s name-attribute enclosed in “%”.
    In addition to that you can use full HTML markup.

    See the examples below.

    example 1

    Corresponding to shortcode example 1

    Firstname: %sql_firstname%
    Lastname: %sql_lastname%
    E-Mail: %sql_mail%

    The mail you receive will look like this:

    Firstname: user’s firstname
    Lastname: user’s lastname
    E-Mail: user’s e-mail

    example 2

    Corresponding to shortcode example 2

    Your user’s gender is %sql_gender%
    and he/she believes that
    %sql_math% is correct.
    Contact him/her by mail: %sql_mail%

    The mail you receive will look like this:

    Your user’s gender is m
    and he/she believes that 4 is correct.
    Contact him/her by mail: [email protected]

    https://www.ads-software.com/plugins/db-form/

Viewing 1 replies (of 1 total)
  • Hi!
    I work with a page of a Swedish school where older students talk about what they do today. Sturegymnasiet When we add new posts are we doing it directly in the database , which is quite complicated for someone who is not good at it .
    I want to make a page where a ” writer ” can add new records and then I found this plugin, it’s simple and well working. I also need to add an image, so I use another plugin namned WordPress file uppload. The image file name has to be the same as the students n?me wich is written in the first field created with the shortcode [ Input label = "Ditt namn" name = "namn" required = "true" ]. In order to do this I need to read the variable from that shortcode, but I did not manage it. Have tried with $ _POST['namn'] , $ _GET['namn'] and even $ _REQUIRE['namn'] without being able to read the variable. What am I doing wrong ? Or do the PHP-code add something more to the variable? Do you have any tip ? Your short documentation was very helpfull.
    Thanks a lot.
    Leif Odmark

Viewing 1 replies (of 1 total)
  • The topic ‘Documentation’ is closed to new replies.