Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

PHP Build a Simple PHP Application Integrating with PayPal Adding Available Sizes

Ramiro Blanco
Ramiro Blanco
7,266 Points

How to get extra credit "gift message" into the paypal form

I'm working on the extra credit and, I've managed to get the short-sleeve/long sleeve into the paypal form by adding an extra drop-down to the button. I've also managed to get a text area in the form to add the gift message of the second step of the extra credit, but I can't get that message to show up in the pay pal order form.

I've modified my settings in my paypal account to allow gift messages, but that doesn't change anything. I would guess I have to create a variable that contains the message and then push that into the form by adding an input at the top of the form such as:

                <form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post"> <!-- Code from the button we created in paypal -->
                    <input type="hidden" name="cmd" value="_s-xclick">
                    <input type="hidden" name="hosted_button_id" value="<?php echo $product["paypal"]; ?>"> <!-- get paypal code from the product array -->
                    <input type="hidden" name="item_name" value="<?php echo $product["name"]; ?>"> <!-- get product name from the product aray -->
                    <input type="hidden" name="item_name" value="<?php echo $giftMessage; ?>">
                    <table>
                        <tr>
                            <th>
                                <input type="hidden" name="on0" value="Size">
                                <label for="os0">Size</label>
                            </th>
                                <td>

However, I have no idea how to get that message in the variable.

I guess this might also be the wrong way to go about this, so if you have any suggestions, they are more than welcome.

Cheers! Ramiro.