PDA

View Full Version : How to pass data into a form for email


IanB
10-24-2003, 10:24 AM
Hi,

I have a problem where the user selects a quote button on my site (www.im-press.co.uk), this then brings up a pop up quote screen and displays the product details at the top of the page. I have passed these details in to the pop up using "./quote.htm?subject=Sparta%20Mugs&step=1".

My problem then is that after the user has filled in the rest of the quote form how do I get this information in to the FORM to email to myself?

I have used the following script to get the details on to the quote screen;

SENDING PAGE
<script language='javascript'
type="text/javascript">

function getKeys()
{
var keys = new Object();
var queryString = location.search.substring(1);
var keyPairs = queryString.split("&");

for(var i = 0; i < keyPairs.length; i++)
{
var position = keyPairs[i].indexOf('=');
if (position == -1) continue;

var keyname = keyPairs[i].substring(0, position );

var keyvalue = keyPairs[i].substring(position + 1);
keys[keyname] = unescape(keyvalue);
}
return keys;
}
</script>

RECEIVING PAGE
<td colspan="2"
align="center">You have requested a quote for
<b><span id="interestedItem"></span></b></p>

<SCRIPT>
queryKeys = getKeys();
document.all["interestedItem"].innerHTML = queryKeys["subject"];
</SCRIPT>

but I have been unable to find any way to get the resultant info from the screen in to a FORM to email back to me.

Any help would be appreciated.

Ian

Willy Duitt
10-24-2003, 01:39 PM
The body of your E-mail would be:

&body=document.all.interestedItem.value

....Willy

IanB
10-24-2003, 04:48 PM
OK sorry, I am obviously not making myself very clear here, what I am trying to do is pass a product description from page 1 in to page 2 where it is display on the page. The product description (which is being displayed OK) then needs to be sent with other details which have been added in page 2 using;
<FORM NAME="quick-quote"
METHOD="POST"
ACTION="http://www.im-press.co.uk/cgi-sys/FormMail.cgi">

What I have been unable to do is get the product description (which is displayed in page 2) added to the FORM which creates the email, so I should have a line that equals something like;
<INPUT TYPE="hidden"
NAME="Description"
VALUE="?">
and its this VALUE field that I am having trouble in populating with the product description?

Any Ideas?