Web Analytics Made Easy -
StatCounter Redirect on select with javascript for paypal form - CodingForum

Announcement

Collapse
No announcement yet.

Redirect on select with javascript for paypal form

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Redirect on select with javascript for paypal form

    Hi all, I'm new here and need some help. I don't know Javascript at all.

    I have a paypal form that looks like this:

    Code:
    <FORM action="https://www.paypal.com/cgi-bin/webscr" method="post">
    <INPUT type="hidden" name="cmd" value="_s-xclick">
    <INPUT type="hidden" name="hosted_button_id" value="VMMCF6CUGBPAN">
    <INPUT type="hidden" name="on0" value="DATA">DATA<BR>
    <SELECT name="os0">
    <OPTION value="250" selected="selected">DATA</OPTION>
    <OPTION value="400">DATA</OPTION>
    <OPTION value="1000">DATA</OPTION>
    </SELECT>
    
    <INPUT type="hidden" name="currency_code" value="USD">
    <BR>
    <INPUT type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!"><IMG alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
    </FORM>
    This form works perfectly with my system now. I'm trying to add one fourth option that will redirect to another page, but I'm not sure if changing the name of the select will break the paypal transaction. So I tried this solution:

    Code:
    <FORM action="https://www.paypal.com/cgi-bin/webscr" method="post">
    <INPUT type="hidden" name="cmd" value="_s-xclick">
    <INPUT type="hidden" name="hosted_button_id" value="VMMCF6CUGBPAN">
    <INPUT type="hidden" name="URL" value="DATA">DATA<BR>
    <SELECT name="URL" onchange="window.location.href= this.form.URL.options[this.form.URL.selectedIndex].value">
    <OPTION value="250" selected="selected">DATA</OPTION>
    <OPTION value="500">500 Words</OPTION>
    <OPTION value="1000">1000 Words</OPTION>
    <OPTION value="project.html">1000+ Words</OPTION>
    </SELECT>
    <INPUT type="hidden" name="currency_code" value="USD">
    <BR>
    <br>
    <INPUT type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!"><IMG alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
    </FORM>
    It works great if I select the fourth option with a internal url in it. But if I choose one of the other options it tries to dynamically change to a page "250", "500", or "1000" and they don't exist.

    Also, I'm not sure if changing the select name or the option value will break the transaction with paypal.

    What I'd like the form to do is nothing on all options except the fourth; which is a redirect. The first, second, and third option require the used to click a paypal buy now button.

    Can't I just take this...

    Code:
    [I]onchange="window.location.href= this.form.URL.options[this.form.URL.selectedIndex].value"[/I]
    ...put it in the option tag and change it to onSelect or something?

    This is as far as I can go. I copied the code and altered it. Can anyone here help please?

  • #2
    Point in the right direction

    Can any of the many coders here help out? Perhaps point me in the right direction?

    Your help appreciated...

    Comment


    • #3
      It looks like there's no life here.

      Comment

      Working...
      X
      😀
      🥰
      🤢
      😎
      😡
      👍
      👎