Forums
This topic is locked
Var problem
Posted 25 Aug 2004 09:34:40
1
has voted
25 Aug 2004 09:34:40 Charles Knight posted:
New to Java but need some help to complete a task.I have a formhandler for sending details from a web form.
I need to combine two fields together.
At the moment the code looks like this:
emailBody += "Interested_In :\r\n\r\n" + interested_in + "\r\n\r\n";
I want to add another form element, like so:
emailBody += "Interested_In :\r\n\r\n" + interested_in & amount + "\r\n\r\n";
But it won't work.
What is the correct way to do this please
cheers
ck
Replies
Replied 25 Aug 2004 11:38:52
25 Aug 2004 11:38:52 Charles Knight replied:
Think I may have made a mistake here, I think I need to put all the code up and re-ask the question:
<%@ Language="JavaScript" %>
<%
// check that we have form data
if ( String( Request.Form( "EmailAddress" ) ) == "undefined" ) {
Response.Redirect( "submit_tender.asp" );
}
// get all form variables as local variables
var name = Request.Form( "Name" );
var company = Request.Form( "Company" );
var address_1 = Request.Form( "Address_1" );
var address_2 = Request.Form( "Address_2" );
var address_3 = Request.Form( "Address_3" );
var address_4 = Request.Form( "Address_4" );
var postcode = Request.Form( "Postcode" );
var country = Request.Form( "Country" );
var emailAddress = Request.Form( "EmailAddress" );
var tel = Request.Form( "Tel" );
var fax = Request.Form( "Fax" );
var mobile = Request.Form( "Mobile" );
var viewing_date = Request.Form( "Viewing_Date" );
var lot = Request.Form( "Lot" );
var lot_no = Request.Form( "Lot_No" );
var interested_in = String( Request.Form("Interested_In"
);
var amount = Request.Form( "Amount" );
// list of email addresses to send form data to, based on province selection
var deptEmailAddresses = new Array( " " );
// contact email
var contactMail = Server.CreateObject( "CDONTS.NewMail" );
// plain text email
contactMail.MailFormat = 1;
contactMail.BodyFormat = 1;
// from
contactMail.From = name + "<" + emailAddress + ">";
// to
contactMail.To = (" "
;
contactMail.Subject = ("Submit Tender"
;
// contact email body
var emailBody = "";
emailBody += "Name : " + name + "\r\n";
emailBody += "Company : " + company + "\r\n";
emailBody += "Address_1 : " + address_1 + "\r\n";
emailBody += "Address_2 : " + address_2 + "\r\n";
emailBody += "Address_3 : " + address_3 + "\r\n";
emailBody += "Address_4 : " + address_4 + "\r\n";
emailBody += "Postcode : " + postcode + "\r\n";
emailBody += "Country : " + country + "\r\n";
emailBody += "EmailAddress : " + emailAddress + "\r\n";
emailBody += "Tel : " + tel + "\r\n";
emailBody += "Fax : " + fax + "\r\n";
emailBody += "Mobile : " + mobile + "\r\n";
emailBody += "Viewing_Date : " + viewing_date + "\r\n";
emailBody += "Lot : " + lot + "\r\n";
emailBody += "Lot_No : " + lot_no + "\r\n";
emailBody += "Interested_In :\r\n" + interested_in + "\r\n\r\n";
contactMail.Body = emailBody;
// send the email
contactMail.Send();
Response.Redirect( "Confirmation.asp" );
%>
How do I combine the "Interested_in" field and the "Amount" to show the two field together but separated by say an equal sign.
A bit like:
"Red Lorry=500"
<%@ Language="JavaScript" %>
<%
// check that we have form data
if ( String( Request.Form( "EmailAddress" ) ) == "undefined" ) {
Response.Redirect( "submit_tender.asp" );
}
// get all form variables as local variables
var name = Request.Form( "Name" );
var company = Request.Form( "Company" );
var address_1 = Request.Form( "Address_1" );
var address_2 = Request.Form( "Address_2" );
var address_3 = Request.Form( "Address_3" );
var address_4 = Request.Form( "Address_4" );
var postcode = Request.Form( "Postcode" );
var country = Request.Form( "Country" );
var emailAddress = Request.Form( "EmailAddress" );
var tel = Request.Form( "Tel" );
var fax = Request.Form( "Fax" );
var mobile = Request.Form( "Mobile" );
var viewing_date = Request.Form( "Viewing_Date" );
var lot = Request.Form( "Lot" );
var lot_no = Request.Form( "Lot_No" );
var interested_in = String( Request.Form("Interested_In"
![](/images/forum/smilies/icon_smile_wink.png)
var amount = Request.Form( "Amount" );
// list of email addresses to send form data to, based on province selection
var deptEmailAddresses = new Array( " " );
// contact email
var contactMail = Server.CreateObject( "CDONTS.NewMail" );
// plain text email
contactMail.MailFormat = 1;
contactMail.BodyFormat = 1;
// from
contactMail.From = name + "<" + emailAddress + ">";
// to
contactMail.To = (" "
![](/images/forum/smilies/icon_smile_wink.png)
contactMail.Subject = ("Submit Tender"
![](/images/forum/smilies/icon_smile_wink.png)
// contact email body
var emailBody = "";
emailBody += "Name : " + name + "\r\n";
emailBody += "Company : " + company + "\r\n";
emailBody += "Address_1 : " + address_1 + "\r\n";
emailBody += "Address_2 : " + address_2 + "\r\n";
emailBody += "Address_3 : " + address_3 + "\r\n";
emailBody += "Address_4 : " + address_4 + "\r\n";
emailBody += "Postcode : " + postcode + "\r\n";
emailBody += "Country : " + country + "\r\n";
emailBody += "EmailAddress : " + emailAddress + "\r\n";
emailBody += "Tel : " + tel + "\r\n";
emailBody += "Fax : " + fax + "\r\n";
emailBody += "Mobile : " + mobile + "\r\n";
emailBody += "Viewing_Date : " + viewing_date + "\r\n";
emailBody += "Lot : " + lot + "\r\n";
emailBody += "Lot_No : " + lot_no + "\r\n";
emailBody += "Interested_In :\r\n" + interested_in + "\r\n\r\n";
contactMail.Body = emailBody;
// send the email
contactMail.Send();
Response.Redirect( "Confirmation.asp" );
%>
How do I combine the "Interested_in" field and the "Amount" to show the two field together but separated by say an equal sign.
A bit like:
"Red Lorry=500"