may Posted August 20, 2006 Share Posted August 20, 2006 Hello, i have got this proble relating to PHP and javascript. I have a form in which there is a field "fee". After filling in the form , the user clicks he button to calculate fee and then this field populates thru javascript.the problem is that since i havent written any value for this explicitly but assigning it value thru javascript, i m getting an error while retrieving it thru the $_REQUEST function.Heres the code i m using:<input name="fee" type="text" id="fee" size="10" disabled="disabled" /></td> </tr> <tr> <td colspan="4"><div align="center"> <input type="button" name="calculate" value="Calculate Total" onclick="return calcTotal()"/>and the javascript is:function calcTotal(){ var group=document.form1.group.options[document.form1.group.selectedIndex].value; var county=document.form1.county.options[document.form1.county.selectedIndex].value; var county_price=(document.form1.county_price.value); var total=0; var url=document.form1.url.value; var url_price=document.form1.url_price.value; if(url=="") url_price=0; if(county=="" && group==""){ alert("Please select a County or a Group to post events to"); document.form1.county.focus(); return false; } if(county!="" && group!=""){ alert("You can select only a County OR a Group to post events to"); document.form1.county.focus(); return false; } if(group!=""){ str=group.split("/"); total=parseInt(str[1])+ parseInt(url_price); document.form1.fee.value=total; return true; } if(county!=""){ total=parseInt(county_price)+parseInt(url_price); document.form1.fee.value=total; return true; }} I have tried requesting other values for fee variable and it works fine , the problem is that when i retrieve the value of fee from the form it gives an error , that my var is not defined.Help me solve this problem. Quote Link to comment https://forums.phpfreaks.com/topic/18138-php-does-not-request-form-value/ Share on other sites More sharing options...
ToonMariner Posted August 21, 2006 Share Posted August 21, 2006 OK.. try thisset fee as a hidden field that is NOT disabled. Replace <input name="fee" type="text" id="fee" size="10" disabled="disabled" />with<span id="dis_fee"></span>and alter this...if(group!=""){ str=group.split("/"); total=parseInt(str[1])+ parseInt(url_price); document.form1.fee.value=total; return true; } if(county!=""){ total=parseInt(county_price)+parseInt(url_price); document.form1.fee.value=total; return true; }toif(group!=""){ str=group.split("/"); total=parseInt(str[1])+ parseInt(url_price); document.form1.fee.value=total; document.getElementById('dis_fee').innerHTML = "£ " + total; return true; } if(county!=""){ total=parseInt(county_price)+parseInt(url_price); document.form1.fee.value=total; document.getElementById('dis_fee').innerHTML = "£ " + total; return true; } Quote Link to comment https://forums.phpfreaks.com/topic/18138-php-does-not-request-form-value/#findComment-77820 Share on other sites More sharing options...
may Posted August 23, 2006 Author Share Posted August 23, 2006 Thanks for the help :)problem is solved Quote Link to comment https://forums.phpfreaks.com/topic/18138-php-does-not-request-form-value/#findComment-79533 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.