Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP Build a Simple PHP Application Integrating with PayPal Building the Shirt Details Page

the paypal code that generated for me does not include <input type ="item_name" value="Logo Shirt, Red">

form.php

                    <form target="paypal" 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="<?php echo $product["paypal"] ?>"; >

                    <table>
                    <tr>
                        <th>
                            <input type="hidden" name="on0" value="Size">
                            <label for="os0">Size</label>
                        </th> 
                        <td><select name="os0" id="os0">
                        <option value="Small">Small </option>
                        <option value="Medium">Medium </option>
                        <option value="Large">Large </option>
                        <option value="X-Large">X-Large </option>
                    </select> </td></tr>
                    </table>
                    <input type="submit" value="Add to Cart" name="submit">
                    </form>

vs. Randy's code; Note line 4 does not exist in my code, yet his page and mine look the same and seem to process payments the same way. What am I missing?

<form target="paypal" 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="LREGR8T9KJVBL">
<input type="item_name" value="Logo Shirt, Red">
<table>
<tr>
    <th>
        <input type="hidden" name="on0" value="Size">
        <label for="os0">Size</label>
    </th> 
    ><td><select name="os0" id="os0">
    <option value="Small">Small </option>
    <option value="Medium">Medium </option>
    <option value="Large">Large </option>
    <option value="X-Large">X-Large </option>
</select> </td></tr>
</table>
<input type="submit" value="Add to Cart" name="submit">
</form>

1 Answer

item_name is not a valid value for the input element's type attribute... I'm guessing it was meant to be another type="hidden" field... in any case, this course is quite old, so the code generated by PayPal might be quite different.

By the way you have a stray > before your opening select tag.