tags:

views:

25

answers:

2

Hi all.

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.

A: 

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'] ?>'>
NAVEED
thats spot on, thanks a lot for this mate. I knew it must be dead simple!
Mark Jones
@Mark Jones: Welcome to Stackoverflow
NAVEED
A: 

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

p diddimus
Cheers guys. I get that .. but on the new page what exactly do I need to do to get the product number into a text field?
Mark Jones