开发者

populate form field with product number value

开发者 https://www.devze.com 2023-01-16 09:56 出处:网络
I\'m hoping this is an easy one for PHP experts. I have a product page, each product has a unique reference number.

I'm hoping this is an easy one for PHP experts.

I have a product page, each product has a unique reference number.

When a user clicks to request more info about a product, a contact form will pop up. I want the product number value from the product to automatically be passed to the product number field of the contact form.

How would I do this?

Thanks, Mark开发者_运维问答.


You can create link like this to pass value to other pages.

<a href='contact.php?product=1'>More Info</a>
<a href='contact.php?product=2'>More Info</a>
<a href='contact.php?product=3'>More Info</a>

Using Javascript something like this:

<a href=\"javascript:window.open('contact.php?product=1','Contact','height=320,width=240');\">More Detail</a>

And get product number on contact page like this:

$_GET['product']

If you want to set product value in any textbox:

<input type='text' value='<?php echo $_GET['product'] ?>'>


Yeah, do this More Info and then use $_GET['product']; to reference the product id on the new page

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号