jeudi 19 septembre 2019

Wp Contact Form - pick and send selected values

So first to explain what i m doing. I'm doing like a pricing page. User checks plan (radio), some addons (checkbox), selects budget(via range slider). I have output of each, but now in the last part, don't know how to proceed.

I've built a contact form. Sends Name, Email, Message correctly. Now with those I need to add what user has selected from above.

Like for an example: Code for the name field

                  <label for="name">Name: <span>*</span> <br>
                <input type="text" name="message_name" value="<?php echo esc_attr($_POST['message_name']); ?>">
              </label>

Now thing is, checkbox, radios, range slider have values

<input  type="checkbox"  id="addOnoption3" name="message_addondata" value="2500" data-label="Feature 1"/>

and email form field for this would be like this

<input type="text" name="message_addondata" value="<?php echo esc_attr($_POST['message_addondata']); ?>"></label>

As you can see, value is entered manually as starting one. To send it, inside value field i have to use something different like in an example above.

Never done this, and can't figure it out, basically how to combine these two so value remains and changes (on range slider) but still use variable with $_POST to "detect and send it in email". Cheers




Aucun commentaire:

Enregistrer un commentaire