Jump to content

Archived

This topic is now archived and is closed to further replies.

grant777

Dynamic product enquiry forms

Recommended Posts

Hi,

I have a question about an enquiry form. I would like to set one up for a range of products. When the customer is on a product page and he/she clicks the enquiry button, I want them to be taken to an enquiry form with the name of the product that they clicked the enquiry button on to appear in a textfield. This product textfield will then change depending on which product page the user is directed to the enquiry form from. Does anyone have any idea as to how I might go about doing this?

Thanks,

Grant

Share this post


Link to post
Share on other sites
I dodn't quite get the "This product textfield will then change depending on which product page the user is directed to the enquiry form from." bit, but here's a quick example to accomplish the first part:

Product view page:

[code]
<form name="myform" method="post" action="enquiry.php">
<input type="hidden" name="prod_name" value="{$pname}"/>
<input type="hidden" name="prod_id" value="{$pid}"/>
<input id="btn" type="submit" value="Enquiry"/>
</form>
[/code]

Enquiry page:

[code]
<form name="myform2" method="post" action="send.php">
<input type="text" value="{$_POST['prod_id']}: {$_POST['prod_name']}"/>
</form>
[/code]

Of course, you need to adjust the variable names. And I would further process the form based on the product id, not its name. The name is only good for the customer's understanding.

;)

Share this post


Link to post
Share on other sites
I hope you are trying to display the display the product name which is selected by user to make an enquiry about that field and display that name in textfield.

In first file use the POST method to pass the values to next file and in enquiry form for the textfield put like this..

Product Name : <inut name="product_name" type="text" value=<?php echo $_POST['product_name'];?>

This post variable is passing from first form and it will display the product selected by user .

Hope this will help you

Cheers:)


Share this post


Link to post
Share on other sites
add on to the above post of joshi.

afther you goto that page you need to select the database and run a query with a were to get the correct product information.

example

[code]
<?php

database

$query="SELECT * from products where product_name='$product_name'";
$result=mysql_query($query);

while($record=mysql_fetch_assoc($result)){

echo tables in good order from the product selected
$record['what_ever_needs_displaying'];

}

?>

[/code]


good luck.


you also might consider useing a link and then a $_GET[' prduct_name'] what's ever easer for you .

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.