isaac_cm Posted October 10, 2006 Share Posted October 10, 2006 I use dreamweaver 8.02 and I have to set the variable $_POST['btn_addtocart_x'] to any value so when the page is post back some php code is executed so I placed the following lines in a javascript script function this function make few checks if it succeed it submit the form and I set the previous variable like that1 $_REQUEST['btn_addtocart_x'] = 1;2 document.forms[0].submit();3 unset($_REQUEST['btn_addtocart_x']);the very strange thing although ffox and IE give me javascript errors to line 1, 3 but it work fine and if I deleted these lines my php script did not work correctly, how this is done ?and is there any other way to Set the variable $_POST['btn_addtocart_x'] correctly and then unset the same variable after submit , I need it that waythanks Quote Link to comment https://forums.phpfreaks.com/topic/23552-wrong-javascript-syntax-but-it-work-any-explanation/ Share on other sites More sharing options...
fenway Posted October 10, 2006 Share Posted October 10, 2006 I have no idea what you're trying to do... but use a hidden INPUT field. Quote Link to comment https://forums.phpfreaks.com/topic/23552-wrong-javascript-syntax-but-it-work-any-explanation/#findComment-106929 Share on other sites More sharing options...
isaac_cm Posted October 10, 2006 Author Share Posted October 10, 2006 sorry,I set the variable $_REQUEST['btn_addtocart_x'] to "1" so my script can work also I need to unset the same variable after I submit the form from a javascirpt functionlike that $_REQUEST['btn_addtocart_x'] = 1; document.forms[0].submit(); unset($_REQUEST['btn_addtocart_x']);please tell me what to do, thanks alot Quote Link to comment https://forums.phpfreaks.com/topic/23552-wrong-javascript-syntax-but-it-work-any-explanation/#findComment-106953 Share on other sites More sharing options...
fenway Posted October 10, 2006 Share Posted October 10, 2006 You're talking about JS (client-side) and PHP (server-side) in the same breath. Set it to "1" with a hidden INPUT field, and then throw it away in your PHP script. Quote Link to comment https://forums.phpfreaks.com/topic/23552-wrong-javascript-syntax-but-it-work-any-explanation/#findComment-106991 Share on other sites More sharing options...
isaac_cm Posted October 10, 2006 Author Share Posted October 10, 2006 thanks you are the man Quote Link to comment https://forums.phpfreaks.com/topic/23552-wrong-javascript-syntax-but-it-work-any-explanation/#findComment-107000 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.