I am using javascript to give values to hidden form fields and then using php to collect that info!
my javascript code....
Code: Select all
<script type="text/javascript" language="javascript">
<!--
window.onload = pagesRequired;
//The following four variables are my hidden form fields...
var Quote = document.form1.Quote.value;
var CMS = document.form1.CMS.value;
var Flash = document.form1.Flash.value;
var PagesHolder = document.form1.Pages.value;
//Loop through the radio buttons to which one is checked and set a value to the hidden form fields!
function pagesRequired() {
var len = document.form1.pages.length;
for(var i = 0; i < len; i++) {
if (document.form1.pages[i].checked == true) {
if (i == 0) {
PagesHolder = "1-4";
}
else if (i == 1) {
PagesHolder = "5-10";
}
else if (i == 2) {
PagesHolder = "11-15";
}
else if (i == 3) {
PagesHolder = "16-20";
}
}
}
}
//-->
</script>
And, here is the php code...
Code: Select all
To: root@xxxxxxxxxxx
From: root@xxxxxxxx
Subject: xxxxxxxxxxx - Online Quote
Name : [r_Name]<br/>
Email address : [re_Email_address]<br/>
Sent : [%DATE_GMT]
<br/><br/>
----------------------------------------------------------------------
<br/><br/>
<strong>Thank you for requsting an online quote.</strong>
<br/><br/>
Based upon the information you provided we have calculated a price of <strong>GBP [Quote]</strong>.
<br/><br/>
The above price is based upon the following....
<br/><br/>
Web Pages : [Pages]<br/>
Content Management : [CMS]<br/>
Flash Content : [Flash]<br/>
I know the javascript IS working because i added a function to alert to the screen the current value of the hidden form fields....i.e. if i presed the radio button 5-10, then clicked the button, it alerted the correct amount!
So i know for sure when radio buttons are pressed that the hidden field was 100% being updated!
When i submit the form it sends an email with an empty value from the hidden form field, even though it has a value that my javascript passed to it!
Any ideas guys?