grant777 Posted September 13, 2006 Share Posted September 13, 2006 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 Quote Link to comment Share on other sites More sharing options...
yaba Posted September 13, 2006 Share Posted September 13, 2006 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.;) Quote Link to comment Share on other sites More sharing options...
joshi_v Posted September 13, 2006 Share Posted September 13, 2006 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 youCheers:) Quote Link to comment Share on other sites More sharing options...
redarrow Posted September 13, 2006 Share Posted September 13, 2006 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]<?phpdatabase$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 . Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.