Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 6 of 6
  1. #1
    Member webmastercorey's Avatar
    Join Date
    Nov 2005
    Location
    Kansas
    Posts
    49
    Member #
    11909
    I need to have a from that can be submitted to a processing page and then i need that page to send it to another processing page (in this case PayPal). How would I go about grabbing the variables on my processing page and resubmit them to a page like PayPal?
    "What good will it be for a man if he gains the whole world, yet forfeits his soul?"
    -Matthew 16:26

  2.  

  3. #2
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,716
    Member #
    5580
    Liked
    717 times
    You'll have to elaborate some more about this because sending to
    PayPal can be done a couple of ways depending on your PayPal setup.

    PayPal has a development site that has more information ...

    Some more things on this ...
    http://www.google.com/search?hl=en&q...=Google+Search

    ======

    The form part is your basic HTML form that posts to a PHP script.
    Within that script, you do what you need with the variables and then
    redirect to PayPal, or whatever ... again, using some PHP functions to
    send data to PayPal.


  4. #3
    Member webmastercorey's Avatar
    Join Date
    Nov 2005
    Location
    Kansas
    Posts
    49
    Member #
    11909
    Okay. Maybe I can get a bit of walk through with this. Here is my code right now with my form on this page or just visit: http://www.herrontrucks.com/order.php

    Code:
        <script type="text/javascript">
          function changeValue1(){
            document.getElementById('amount').value = '23.00';
            document.getElementById('item_name').value = 'Individual 7.625 inch Herron Trucks';
            document.getElementById('shipping').value = '10.99';
          }
          
          function changeValue2(){
            document.getElementById('amount').value = '156.00';
            document.getElementById('item_name').value = '1/4 Case (12 Trucks) 7.625 inch Herron Trucks';
            document.getElementById('shipping').value = '18.99';
          }
          
          function changeValue3(){
            document.getElementById('amount').value = '312.00';
            document.getElementById('item_name').value = '1/2 Case (24 Trucks) 7.625 inch Herron Trucks';
            document.getElementById('shipping').value = '18.99';
          }
          
          function changeValue4(){
            document.getElementById('amount').value = '624.00';
            document.getElementById('item_name').value = '1 Case (48 Trucks) 7.625 inch Herron Trucks';
            document.getElementById('shipping').value = '0.00';
          }
        </script>
    HTML Code:
    <form name="order_form" method="post" action="https://www.paypal.com/cgi-bin/webscr">
                      <table id="form-table">
                        <tr>
                          <td>
                            <strong>First Name:</strong>
                          </td>
                          <td>
                            <input name="first_name" type="text" id="first_name" size="25" maxlength="32" class="inputs" />*
                          </td>
                        </tr>
                        <tr>
                          <td>
                            <strong>Last Name:</strong>
                          </td>
                          <td>
                            <input name="last_name" type="text" id="last_name" size="25" maxlength="64" class="inputs" />*
                          </td>
                        </tr>
                        <tr>
                          <td>
                            <strong>Email:</strong>
                          </td>
                          <td>
                            <input name="email" type="text" id="email" size="25" maxlength="127" class="inputs" />*
                          </td>
                        </tr>
                        <tr>
                          <td>
                            <strong>Address:</strong>
                          </td>
                          <td>
                            <textarea name="address1" cols="19" rows="2" id="address1" class="inputs" ></textarea>*
                          </td>
                        </tr>
                        <tr>
                          <td>
                            <strong>City:</strong>
                          </td>
                          <td>
                            <input name="city" type="text" id="city" size="10" maxlength="100" class="inputs" />*
                            <input name="country" type="hidden" id="country" size="10" value="United States" maxlength="255" class="inputs" />
                          </td>
                        </tr>
                        <tr>
                          <td>
                            <strong>State:</strong>
                          </td>
                          <td>
                            <select name="state">
                              <option value="null">&nbsp;</option>
                              <option value="AK">AK</option>
                              <option value="AL">AL</option>
                              <option value="AR">AR</option>
                              <option value="AZ">AZ</option>
                              <option value="CA">CA</option>
                              <option value="CO">CO</option>
                              <option value="CT">CT</option>
                              <option value="DC">DC</option>
                              <option value="DE">DE</option>
                              <option value="FL">FL</option>
                              <option value="GA">GA</option>
                              <option value="HI">HI</option>
                              <option value="IA">IA</option>
                              <option value="ID">ID</option>
                              <option value="IL">IL</option>
                              <option value="IN">IN</option>
                              <option value="KS">KS</option>
                              <option value="KY">KY</option>
                              <option value="LA">LA</option>
                              <option value="MA">MA</option>
                              <option value="MD">MD</option>
                              <option value="ME">ME</option>
                              <option value="MI">MI</option>
                              <option value="MN">MN</option>
                              <option value="MO">MO</option>
                              <option value="MS">MS</option>
                              <option value="MT">MT</option>
                              <option value="NC">NC</option>
                              <option value="ND">ND</option>
                              <option value="NE">NE</option>
                              <option value="NH">NH</option>
                              <option value="NJ">NJ</option>
                              <option value="NM">NM</option>
                              <option value="NV">NV</option>
                              <option value="NY">NY</option>
                              <option value="OH">OH</option>
                              <option value="OK">OK</option>
                              <option value="OR">OR</option>
                              <option value="PA">PA</option>
                              <option value="RI">RI</option>
                              <option value="SC">SC</option>
                              <option value="SD">SD</option>
                              <option value="TN">TN</option>
                              <option value="TX">TX</option>
                              <option value="UT">UT</option>
                              <option value="VA">VA</option>
                              <option value="VT">VT</option>
                              <option value="WA">WA</option>
                              <option value="WI">WI</option>
                              <option value="WV">WV</option>
                              <option value="WY">WY</option>
                            </select>*
                          </td>
                        </tr>
                        <tr>
                          <td>
                            <strong>Zip:</strong>
                          </td>
                          <td>
                            <input name="zip" type="text" id="zip" size="6" maxlength="10" class="inputs" />*
                          </td>
                        </tr>
                        <tr>
                          <td>
                            <strong>Phone:</strong>
                          </td>
                          <td>
                            (<input name="night_phone_a" type="text" id="night_phone_a" size="3" maxlength="3" class="inputs" />)<input name="night_phone_b" type="text" id="night_phone_b" size="3" maxlength="16" class="inputs" />-<input name="night_phone_c" type="text" id="night_phone_c" size="4" maxlength="4" class="inputs" />*
                          </td>
                        </tr>
                        <tr>
                          <td colspan="2">
                            <i>7.625 inch Herron Trucks*</i>
                          </td>
                        </tr>
                        <tr>
                          <td>
                            <strong>Price:</strong>
                          </td>
                          <td>
                            <input type="radio" name="item_number" value="001" onclick="changeValue1()" checked/>$23.00 USD (Individual)<br />
                            <input type="radio" name="item_number" value="002" onclick="changeValue2()" />1/4 Case (12 Trucks) $156.00<br />
                            <input type="radio" name="item_number" value="003" onclick="changeValue3()" />1/2 Case (24 Trucks) $312.00<br />
                            <input type="radio" name="item_number" value="004" onclick="changeValue4()" />1 Case (48 Trucks) $624.00<br />
                            </td>
                        </tr>
                        <tr>
                          <td colspan="2">
                            <i>Shipping and Handling:</i>
                          </td>
                        </tr>
                        <tr>
                          <td></td>
                          <td>
                            + $10.99 ($160.00 or less)<br />
                            + $18.99 ($161.00 to $313.00)<br />
                            + $26.99 ($314.00 to $500.00)<br />
                            FREE ($501.00 and up)<br />
                          </td>
                        </tr>
                        <tr>
                          <td>
                            <strong>Amount:</strong>
                          </td>
                          <td>
                            <input name="quantity" size="5" maxlength="5" value="1" />*
                          </td>
                        </tr>
                      </table>             
                      <div id="submit">
                        <input type="hidden" name="cmd" value="_xclick" />
                        <input type="hidden" name="business" value="info@herrontrucks.com" />
                        <input type="hidden" name="item_name" id="item_name" value="7.625 inch Herron Trucks (Individual)" />
                        <input type="hidden" name="amount" id="amount" value="23.00" />
                        <input type="hidden" name="shipping" id="shipping" value="10.99" />
                        <input type="hidden" name="handling" value="0.00" />
                        <input type="hidden" name="currency_code" value="USD" />
                        <input type="hidden" name="return" value="./thank-you.php" />
                        <i>*Required Fields</i><br />
                        <input name="submit" type="image" src="./images/submit-order.jpg" value="submit" />
                        <input type="image" src="./images/reset.jpg" name="submit" value="Reset" onclick="this.form.reset();return false;" />
                      </div>
                   </form>
    My client needs the shipping and handling to increases as the price increases and there are 4 different ways to buy the same product. I need the hidden forms on this page to change their values somehow. I am currently using javascript but if it's not enabled I run the risk of the forum not working, and I haven't even got the javascript to change the shipping and handling value as price increases.

    It's stressing me out like crazy and I need to find some sort of solution soon. I haven't seen anything on the paypal site that can help me here.

    And as javascript doesn't seem to be the right method I was thinking that I can have the user:

    Fill in the Results > Submit the Results to my PHP page > My PHP page then changes the variables and does that math for the Shipping and Handling > The PHP page then submits it to PayPal


    But I don't know how to resubmit these variables... any better ideas? :S
    "What good will it be for a man if he gains the whole world, yet forfeits his soul?"
    -Matthew 16:26

  5. #4
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,716
    Member #
    5580
    Liked
    717 times
    I would separate the forms so you have a "calculate form" and a "confirmation form".

    You display the main form and have them select things.
    They click a re-calculate button that calls a PHP script.
    That PHP script re-displays the form again, with the changes made.

    When they are ready to send to PayPal, they click a "Pay Now" button
    instead of the "re-calculate" button. Another PHP script displays a
    confirmation form that then gets sent to PayPal, when they click OK.

    This would eliminate all Javascripting, and the PHP script that determines
    costs could read variables from a simple text file. That text file contains
    the part number, qty, and shipping, so when the user selects an item, or
    quantity and clicks "re-calculate", the changes are made when the form
    re-displays.

    You could also use session cookies, where the choices are retained for the
    user until they close their browser. This would allow them to leave your
    form page, go somewhere else, and return with the values still in place.

    Your client (who owns the site), could make changes to the text file for
    price changes or shipping cost changes. They would not have to edit the
    web pages themselves. They might like that feature. And it could all be
    done without MySQL, using a simple flat-file text database.

    You did post this thread on PHP, so I assume you have some PHP skills?

    ... that's the way I would approach it anyhow.


  6. #5
    Member webmastercorey's Avatar
    Join Date
    Nov 2005
    Location
    Kansas
    Posts
    49
    Member #
    11909
    I have some PHP skills yes, but i'm not an expert by any means. I can look at the code change it to suit my needs and alter it to do what I want. I know how to pull the variables that are submitted to a page. But my problem is, i'm not sure how to resubmit those variables from that page.

    You talked about having another php form that they would then resubmit? Am I able to plug those variables as a VALUE for each text box using $_POST['variable']? And then they click submit? I'm not sure how I might do that with the option boxes...

    Thanks for helping!
    "What good will it be for a man if he gains the whole world, yet forfeits his soul?"
    -Matthew 16:26

  7. #6
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,716
    Member #
    5580
    Liked
    717 times
    The "confirmation form" isn't really a form,
    it's a summary of the total amount that will
    be going to PayPal.

    When it's all said and done, you'll be sending PayPal
    one amount (amount and shipping). You didn't mention
    if you are sending PayPal one item number, or will they
    have multiple items?

    So that confirmation page is basically just this part:

    Code:
    <div id="submit">
                        <input type="hidden" name="cmd" value="_xclick" />
                        <input type="hidden" name="business" value="info@herrontrucks.com" />
                        <input type="hidden" name="item_name" id="item_name" value="7.625 inch Herron Trucks (Individual)" />
                        <input type="hidden" name="amount" id="amount" value="23.00" />
                        <input type="hidden" name="shipping" id="shipping" value="10.99" />
                        <input type="hidden" name="handling" value="0.00" />
                        <input type="hidden" name="currency_code" value="USD" />
                        <input type="hidden" name="return" value="./thank-you.php" />
                        <i>*Required Fields</i><br />
                        <input name="submit" type="image" src="./images/submit-order.jpg" value="submit" />
                        <input type="image" src="./images/reset.jpg" name="submit" value="Reset" onclick="this.form.reset();return false;" />
                      </div>
    The user then sees that confirmation page and says, "yea, I'm done, I'll pay it", or
    else they can go back and change something. When they go back, they will see
    the previous form (the script that does the main form) ... it will have all of the
    fields filled-in with whatever the user did previously.

    That's the really nice thing about PHP, you can save all of their form variables
    in session cookies so that the user can keep changing things until they are ready
    to pay.

    If you choose not to use sessions, you can pass variables from one page to another
    by using <input type="hidden" .... > for each variable that needs to be kept.

    I wish I had time to make an actual example, but I'm swamped.



Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 09:38 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com