Jump to content

wrong javascript syntax but it work any explanation ?


isaac_cm

Recommended Posts

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 that

1   $_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 way

thanks
Link to comment
Share on other sites

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 function
like that
    $_REQUEST['btn_addtocart_x'] = 1;
    document.forms[0].submit();
    unset($_REQUEST['btn_addtocart_x']);
please tell me what to do, thanks alot


Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.