Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New Coder
    Join Date
    Jul 2008
    Posts
    14
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Submit form on event

    i have a paypal button code which is basically a form that gets submitted

    the code for the button wud be like this

    Code:
    <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
    <input type="hidden" name="cmd" value="_xclick">
    <input type="hidden" name="business" value="email">
    <input type="hidden" name="item_name" value="cd name">
    <input type="hidden" name="item_number" value="36676y">
    <input type="hidden" name="amount" value="1.00">
    <input type="hidden" name="shipping" value="1.00">
    <input type="hidden" name="no_shipping" value="0">
    <input type="hidden" name="no_note" value="1">
    <input type="hidden" name="currency_code" value="USD">
    <input type="hidden" name="weight" value="1">
    <input type="hidden" name="weight_unit" value="lbs">
    <input type="hidden" name="lc" value="US">
    <input type="hidden" name="bn" value="PP-BuyNowBF">
    <input type="image" src="https://www.paypal.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.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
    </form>
    and i want to make a page that when it loads it submits that form and sends the values to paypal so it shows the payment page for my product

    i wanna do this coz most forums have disabled HTML in posts and i am advertising sumthing for sale

    so i wanna create a page for example sales... wud submit the info and redirect the user to paypal account that was submitted

    so basically how to activate the submit button on load event ?

    thanx
    Last edited by K-PRO; 07-12-2008 at 12:08 AM.

  • #2
    Senior Coder jcdevelopment's Avatar
    Join Date
    Oct 2007
    Location
    Cowboy Nation
    Posts
    2,182
    Thanks
    174
    Thanked 257 Times in 257 Posts
    did you want something like this

    Code:
    onsubmit="window.location='index.htm'
    so it would be this

    Code:
    <form action="https://www.paypal.com/cgi-bin/webscr" method="post" onsubmit="window.location='paypal site.html';">
    <input type="hidden" name="cmd" value="_xclick">
    <input type="hidden" name="business" value="email">
    <input type="hidden" name="item_name" value="cd name">
    <input type="hidden" name="item_number" value="36676y">
    <input type="hidden" name="amount" value="1.00">
    <input type="hidden" name="shipping" value="1.00">
    <input type="hidden" name="no_shipping" value="0">
    <input type="hidden" name="no_note" value="1">
    <input type="hidden" name="currency_code" value="USD">
    <input type="hidden" name="weight" value="1">
    <input type="hidden" name="weight_unit" value="lbs">
    <input type="hidden" name="lc" value="US">
    <input type="hidden" name="bn" value="PP-BuyNowBF">
    <input type="image" src="https://www.paypal.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.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
    </form>

  • #3
    New Coder
    Join Date
    Jul 2008
    Posts
    14
    Thanks
    3
    Thanked 0 Times in 0 Posts
    no no

    i meant as soon as i open the page it submits the form
    so basically no need to click the button

    when i open the page it performs the action

  • #4
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    You need to give the form a name or an id.
    Code:
    <form name="theform" id="theform">
    then you can use
    Code:
    document.forms['theform'].submit();
    or
    Code:
    document.getElementById('theform').submit();
    but you need to put it towards the bottom of the page to make sure the form as loaded completely or you can use window.onload
    Code:
    window.onload = function()
    {
    // submit the form
    }
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • Users who have thanked _Aerospace_Eng_ for this post:

    K-PRO (07-12-2008)

  • #5
    New Coder
    Join Date
    Jul 2008
    Posts
    14
    Thanks
    3
    Thanked 0 Times in 0 Posts
    when i insert those it displays it as text in the page and doesnt really define it as a code
    i tried all 3 codes

    from what i know (and i dnt know much) that they shud be in some sort of function ?
    i dont know please help me

    thank you

  • #6
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    You were supposed to put those inside of script elements
    Code:
    <script type="text/javascript">// insert what I gave you here</script>
    I suggest you actually learn how to do this stuff. Do some more tutorials. This stuff is basic.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • Users who have thanked _Aerospace_Eng_ for this post:

    K-PRO (07-12-2008)

  • #7
    New Coder
    Join Date
    Jul 2008
    Posts
    14
    Thanks
    3
    Thanked 0 Times in 0 Posts
    oops sorry... lol i didnt think much m kinda exhausted
    works so sweet i cant believe it

    thanx alot


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •