Jump to content

Dynamic product enquiry forms


grant777

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
Link to comment
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.

;)
Link to comment
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:)


Link to comment
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 .
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.