How to create a button that will add Product Name in text field?

car_ng
New Member
1 0 0

Hi,

Hope someone can help me with this. I have created a button ("book viewing appointment") on my product page which will lead to another page ("appointment booking form"). I'd like some indication on the "appointment booking form" page whether it's an url or the product name to be automatically populated in the text field of the form once the button is clicked. Can someone shed some lights on how to do this, please?

The button code I've inserted on my Product page:

<div class="text-center">
<p>
<p>
<a href="weblink of the appointment booking form" class="btn">
BOOK VIEWING APPOINTMENT
</a>
</p>
</p>
</div>

 

The code of the text field I've added in the "appointment booking form" page is as below. At the moment it's having a placeholder text which I hope it can be filled automatically with the (previous) product page's url/product name that leads to the booking form when the button is clicked.

	<label for="ContactFormProduct">Product *</label>
		<input
          required
          class="required"
		  type="text"
		  id="ContactFormProduct"
		  name="contact[Product]"
		  placeholder="Product that I wish to view"
		/>    

 

Many thanks!

0 Likes