ttmt Posted January 20, 2012 Share Posted January 20, 2012 Paypal dropdrop menu / Add to Cart Hi all I'm working on linking a type foundry website to paypal so the fonts can be purchased online. The price of the fonts is determined by the number of devices the fonts will be installed on. I have created this page to add the fonts to a cart with a drop menu on each weight to determine the price. http://www.ttmt.org.uk/forum-paypal/1/ Each drop down is created with a function called from the html. <?php item("Basic Family", "Family", "Bas-Fa", "130"); item("Basic Light", "Light", "Bas-Lt", "20"); item("Basic Regular", "Regular", "Bas-Rg", "20"); item("Basic Medium", "Medium", "Bas-Md", "20"); item("Basic Bold", "Bold", "Bas-Bd", "20"); item("Basic Light Italic", "Light Italic", "Bas-LtIt", "20"); item("Basic Italic", "Italic", "Bas-It", "20"); item("Basic Medium Italic", "Medium Italic", "Bas-MdIt", "20"); item("Basic Bold Italic", "Bold Italic", "Bas-BdIt", "20"); ?> <?php function item( $name, $weight, $number, $price){ $to5 = $price; $to25 = ($price*200)/100; $to50 = ($price*300)/100; $to75 = ($price*400)/100; $to100 = ($price*500)/100; $to150 = ($price*600)/100; $to250 = ($price*700)/100; $to400 = ($price*900)/100; $to500 = ($price*1000)/100; $to600 = ($price*1250)/100; $to700 = ($price*1500)/100; $to850 = ($price*1750)/100; $to1000 = ($price*2000)/100; // $img = "../images/".$image; echo " <div class='product'> <div class='productInfo'> <h3>".$weight."<span> - from £".$price."</span></h3> <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='[email protected]'> <input type='hidden' name='lc' value='GB'> <input type='hidden' name='item_name' value='".$name."'> <input type='hidden' name='item_number' value='".$number."'> <input type='hidden' name='button_subtype' value='products'> <input type='hidden' name='no_note' value='0'> <input type='hidden' name='cn' value='Add special instructions to the seller'> <input type='hidden' name='no_shipping' value='2'> <input type='hidden' name='add' value='1'> <input type='hidden' name='bn' value='PP-ShopCartBF:btn_cart_LG.gif:NonHosted'> <table> <tr><td><input type='hidden' name='on0' value='Number of Users' id='numberOfUsers'></td></tr><tr><td><select name='os0' class='numUserSelect'> <option value='Up to 5'>Number of Users</option> <option value='Up to 5'>Up to 5 - £".$to5."</option> <option value='Up to 25'>Up to 25 - £".$to25."</option> <option value='Up to 50'>Up to 50 - £".$to50."</option> <option value='Up to 75'>Up to 75 - £".$to75."</option> <option value='Up to 100'>Up to 100 - £".$to100."</option> <option value='Up to 150'>Up to 150 - £".$to150."</option> <option value='Up to 250'>Up to 250 - £".$to250."</option> <option value='Up to 400'>Up to 400 - £".$to400."</option> <option value='Up to 500'>Up to 500 - £".$to500."</option> <option value='Up to 600'>Up to 600 - £".$to600."</option> <option value='Up to 700'>Up to 700 - £".$to700."</option> <option value='Up to 850'>Up to 850 - £".$to850."</option> <option value='Up to 1000'>Up to 1000 - £".$to1000."</option> </select> </td></tr> </table> <input type='hidden' name='currency_code' value='GBP'> <input type='hidden' name='option_select0' value='Up to 5'> <input type='hidden' name='option_amount0' value='".$to5."'> <input type='hidden' name='option_select1' value='Up to 5'> <input type='hidden' name='option_amount1' value='".$to5."'> <input type='hidden' name='option_select2' value='Up to 25'> <input type='hidden' name='option_amount2' value='".$to25."'> <input type='hidden' name='option_select3' value='Up to 50'> <input type='hidden' name='option_amount3' value='".$to50."'> <input type='hidden' name='option_select4' value='Up to 75'> <input type='hidden' name='option_amount4' value='".$to75."'> <input type='hidden' name='option_select5' value='Up to 100'> <input type='hidden' name='option_amount5' value='".$to100."'> <input type='hidden' name='option_select6' value='Up to 150'> <input type='hidden' name='option_amount6' value='".$to150."'> <input type='hidden' name='option_select7' value='Up to 250'> <input type='hidden' name='option_amount7' value='".$to250."'> <input type='hidden' name='option_select8' value='Up to 400'> <input type='hidden' name='option_amount8' value='".$to400."'> <input type='hidden' name='option_select9' value='Up to 500'> <input type='hidden' name='option_amount9' value='".$to500."'> <input type='hidden' name='option_select10' value='Up to 600'> <input type='hidden' name='option_amount10' value='".$to600."'> <input type='hidden' name='option_select11' value='Up to 700'> <input type='hidden' name='option_amount11' value='".$to700."'> <input type='hidden' name='option_select12' value='Up to 850'> <input type='hidden' name='option_amount12' value='".$to850."'> <input type='hidden' name='option_select13' value='Up to 1000'> <input type='hidden' name='option_amount13' value='".$to1000."'> <input type='hidden' name='option_index' value='0'> <input class='button' type='image' src='addToCart.png' border='0' name='submit' alt='PayPal — The safer, easier way to pay online.'> <img alt='' border='0' src='https://www.paypalobjects.com/en_GB/i/scr/pixel.gif' width='1' height='1'> </form> </div><!-- #productInfo --> </div>"; } ?> Instead of having a drop down menu I would like to have an input text box to enter the number of devices. http://www.ttmt.org.uk/forum-paypal/2/ My problem is how can I capture the figure in the input textbox and then use if statements to add the value to the cart. Hope this makes sense and someone can help. Any help would be greatly appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/255429-paypal-dropdrop-menu-add-to-cart/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.