php - How to add custom information (ex. title of event) to form submission -


situation: i'm building website on bootstrap 3.0, , contains section upcoming events. if user wants attend, can clicking on event. modal appears name, e-mail , event title input fields. e-mail goes me know who's coming what. html single event:

<div class="col-md-6">    <div class="event-left">       <div class="event-date">          <h1>15 mrt</h1>       </div>       <div class="event-title">          <p>random event title</p>       </div>       <a class="cta-button" data-toggle="modal" data-target="#mymodal"><i class="fa fa-chevron-right fa-lg"></i></a>       <div class="event-text">          <p>random event description</p>       </div>    </div> </div> 

question: how can code this, automatically adds title of event e-mail clicking on event? don't want users type event title manually when modal appears. i'm open better ways this.

current process: visitor clicks on event > fills in name, e-mail , event title > submits form

future process: visitor clicks on event > fills in name, email > submits form

info: i'll using wordpress cms.

i'm assuming working custom post type events.

yes, need populate hidden field yourself. on single template, in form markup, can output title of event value of hidden field using wordpress function the_title(). javascript, kind of situation wordpress templates , php made for.

you might think grabbing event post id event using the_id(). 2 events can have same title, never have same post id.

<form id="your_form" action="/" method="get">     <input type="hidden" name="hidden_info_event_title" value="<?php the_title() ?>" >   <input type="hidden" name="hidden_info_event_id" value="<?php the_id() ?>" >   <input type="submit" value="submit"> </form> 

it worth noting though named "hidden field", values accessible using form, , after page loads , php output, can changed , submitted. if have restrictions on events shown users, can potentially replace title in form event shouldn't able rsvp for, you'd never know email receive. that's whole other question.


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -