I am trying insert the title of a post in the option value of a form for paypal purchase, so I know what item they have chosen. But when I do this paypal gives me a error message that something is wrong with my site. Am I doing this wrong I am trying to insert the title of a post in a option value below.

<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="business" value="7MNYTPNDKMZS6">
<input type="hidden" name="lc" value="CA">
<input type="hidden" name="item_name" value="Tshirt">
<input type="hidden" name="button_subtype" value="products">
<input type="hidden" name="tax_rate" value="0.000">
<input type="hidden" name="shipping" value="0.00">
<input type="hidden" name="add" value="1">
<input type="hidden" name="bn" value="PP-ShopCartBF:cart.png:NonHosted">
<tr><td><input type="hidden" name="on0" value="Tshirt">Tshirt</td></tr><tr><td><select name="os0">
    <option value="<?php the_title();?>">Deer $20.00 CAD</option>
</select> </td></tr>
<tr><td><input type="hidden" name="on1" value="sex">sex</td></tr><tr><td><select name="os1">
    <option value="female">female </option>
    <option value="male">male </option>
</select> </td></tr>
<tr><td><input type="hidden" name="on2" value="T-shirt Style">T-shirt Style</td></tr><tr><td><select name="os2">
    <option value="Crew">Crew </option>
    <option value="V-neck">V-neck </option>
    <option value="Deep-V">Deep-V </option>
    <option value="Tank">Tank </option>
</select> </td></tr>
<tr><td><input type="hidden" name="on3" value="T-shirt size">T-shirt size</td></tr><tr><td><select name="os3">
    <option value="XS">XS </option>
    <option value="S">S </option>
    <option value="M">M </option>
    <option value="L">L </option>
    <option value="XL">XL </option>
</select> </td></tr>
<tr><td><input type="hidden" name="on4" value="Effect">Effect</td></tr><tr><td><select name="os4">
    <option value="faded">faded </option>
    <option value="rainbow">rainbow </option>
    <option value="gradient">gradient </option>
    <option value="glow">glow </option>
</select> </td></tr>
<tr><td><input type="hidden" name="on5" value="T-shirt colour">T-shirt colour</td></tr><tr><td><input type="text" name="os5" maxlength="200"></td></tr>
<tr><td><input type="hidden" name="on6" value="Design Colour">Design Colour</td></tr><tr><td><input type="text" name="os6" maxlength="200"></td></tr>
<input type="hidden" name="currency_code" value="CAD">
<input type="hidden" name="option_select0" value="Deer">
<input type="hidden" name="option_amount0" value="20.00">
<input type="hidden" name="option_index" value="0">
<input type="image" src="http://goodmorningmoon.ca/wp-content/themes/Good-Morning-Moon/images/cart.png" 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">
  • try get_the_title(); instead - assuming you're inside the loop. – Simon Mar 22 '12 at 20:23

why not pass the title as another hidden input? doesn't seem like much reason for a select element when you only have 1 option.

<input type="hidden" name="on0" value="<?php the_title();?>">
| improve this answer | |
  • I will try that, thanks for always helping me you my hero. – Anders Kitson Mar 22 '12 at 21:13
  • flattery will get you everywhere. hope it works, i'm not really sure. – helgatheviking Mar 22 '12 at 23:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.