Jump to content


Photo

Dynamic product enquiry forms


  • Please log in to reply
3 replies to this topic

#1 grant777

grant777
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 13 September 2006 - 03:11 AM

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

#2 yaba

yaba
  • Members
  • PipPip
  • Member
  • 27 posts

Posted 13 September 2006 - 03:41 AM

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:

<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>

Enquiry page:

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

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.

;)

#3 joshi_v

joshi_v
  • Members
  • PipPipPip
  • Advanced Member
  • 168 posts

Posted 13 September 2006 - 09:50 AM

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:)




#4 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 13 September 2006 - 11:05 AM

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

<?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'];

}

?>



good luck.


you also might consider useing a link and then a $_GET[' prduct_name'] what's ever easer for you .
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users