I have a product webiste of shawls and scarves. i want to make feedback form... but when a customer click on send enquiry and send us the enquiry.. we did not know which item has he asked for? So, how can we do so? can anybody recomend us a script or any other solution? Also we need tell a friend script?
you could do a few things. On the form, you could add a drop down item list and ask the user to pick which item they purchased, also make this so they can't submit unless they have selected an item from the list. If the feed back is stored in a mysql database you just add a new column in the database and modify the mysql query that adds the feedback data to the database to include the new item. If it straight out emails you the feedback i can modify this also. Or it's possible to forward the Style No. into the next page and automatically add that to the enquiry, which would be more in keeping with your design i guess. I can add a tell a friend section easy. Want help with this?, shouldn't take to long to do, no payment of course (trying to increase my reputation).
Kindly let us know how to make sql databse.. and drop down menu list? Also, let us know about the tell a friend script?
You would add something like this to the enquiry form code: <select name="stylenumber_dropdown"> <option value="SEPS035">SEPS035</option> <option value="SEPS036">SEPS036</option> <option value="SEPS037">SEPS037</option> </select> Code (markup): This method could take a very long time... However, it is possible to make php automate this, but only if your items data is stored in a database or file? If it is then you can query mysql for the data, load it into an array and then create a loop which loops through all the items and adds them to the drop down menu. It would look something like this: <?php $query = "SELECT * FROM shop_item"; //shop_item may have a different nameing convention in your database ?> <?php $result = mysql_query($query) or die(mysql_error()); ?> <select name="stylenumber_dropdown"> <?php while($row = mysql_fetch_array($result)){ // <- this is the start of the loop ?> <option value="<?php $row['stylenumber'] ?>"><?php $row['stylenumber'] ?></option> <?php } // <- is the end of the loop ?> </select> Code (markup): You can add the name to the list too if you wanted. Now use something like "sqlyog" and login to your mysql database, find the table where your sites item data is stored and add a new column called "styleID" or something you will remember After you've done that, you need to alter the action file of the form, let's assume it's called file.php (this will probably be different on your website tho) <form name="enquiry" action="file.php"> </form> Code (markup): Inside that file you can alter the mysql query and make it add the the style no. to the mysql query. It's quite hard to help you without seeing the code and how your website does things, so half of what i have said could be wrong. Tell a friend script: Found this at http://www.javascriptkit.com/script/script2/tellafriend.shtml <SCRIPT LANGUAGE="JavaScript"> <!-- Begin //Script by Trånn: http://come.to/tronds //Submitted to JavaScript Kit (http://javascriptkit.com) //Visit http://javascriptkit.com for this script var initialsubj="Hay buddy, take a look at this" var initialmsg="Hi:\n You may want to check out this site: "+window.location var good; function checkEmailAddress(field) { var goodEmail = field.value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\.info)|(\.sex)|(\.biz)|(\.aero)|(\.coop)|(\.museum)|(\.name)|(\.pro)|(\..{2,2}))$)\b/gi); if (goodEmail) { good = true; } else { alert('Please enter a valid address.'); field.focus(); field.select(); good = false; } } u = window.location; function mailThisUrl() { good = false checkEmailAddress(document.eMailer.email); if (good) { //window.location = "mailto:"+document.eMailer.email.value+"?subject="+initialsubj+"&body="+document.title+" "+u; window.location = "mailto:"+document.eMailer.email.value+"?subject="+initialsubj+"&body="+initialmsg } } // End --> </script> <form name="eMailer"> Tell a friend: <input type="text" name="email" size="26" value=" Enter Address Here" onFocus="this.value=''" onMouseOver="window.status='Enter email address here and tell a friend about this site...'; return true" onMouseOut="window.status='';return true"> <br /> <input type="button" value="Send this URL" onMouseOver="window.status='Click to send an email (with this page address) to a friend! Enter email address above...'; return true" onMouseOut="window.status='';return true" onClick="mailThisUrl();"> </form> Code (markup):
We will use the following code as we have a html based website:-- <select name="stylenumber_dropdown" <option value="SEPS035">SEPS035</option> <option value="SEPS036">SEPS036</option> <option value="SEPS037">SEPS037</option> </select> But i want to know if customer want to select more items then what will be the code? also let us know the code for submission path.
By submission path you mean the action file? If so then it's this http://www.antiqueshawls.com/sendmail.php Yes it's possible to select more than one item from a list: <SELECT NAME="stylenumber_dropdown" SIZE=10 MULTIPLE> <option value="SEPS035">SEPS035</option> <option value="SEPS036">SEPS036</option> <option value="SEPS037">SEPS037</option> </SELECT> Code (markup): SIZE is the amount of items the box will display vertically. Users have to hold down the left mouse button and drag or hold shift/ctrl whilst clicking on the list, so it may be a good idea to inform the users of this in case they are noobs. sendmail.php will have to be altered tho, to add the selected items data into the e-mail that it sends you. Hope this helps, Lee.
Thanks for the information provided. We want to ask one more question-- what changes we have to do in sendmail.php file. so that we can know the style no. required by the customer.
Hey there, soz i took a while to reply, i am living in a caravan atm because i have just been evicted so it's a bit rubbish here atm... The answer to your question is, you retrieve it like any other field from a form, $items = array(); if ($_GET['SEPS035']) { $items['SEPS035'] = $_GET['SEPS035']; } if ($_GET['SEPS036']) { $items['SEPS036'] = $_GET['SEPS036']; } if ($_GET['SEPS037']) { $items['SEPS037'] = $_GET['SEPS037']; } Code (markup): then you create a loop that works its way through all the array elements and prints it into the email. Something like this: foreach($items as $value) { print "$value<br>"; } Code (markup): hope this helps