Hey guys I have the following <?PHP if (isset($_POST['submit'])) { $total = $_POST['total']; $ds1 = (isset($_POST['checkbox1'])) ? 'DS-1' : null; $ds2 = (isset($_POST['checkbox2'])) ? 'DS-2' : null; $ds3 = (isset($_POST['checkbox3'])) ? 'DS-3' : null; $ds4 = (isset($_POST['checkbox4'])) ? 'DS-4' : null; $ds5 = (isset($_POST['checkbox5'])) ? 'DS-5' : null; $ds6 = (isset($_POST['checkbox6'])) ? 'DS-6' : null; header("location: https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=your@webworld.com&amount=$total&item_name="); } ?> well if you look in the php header function and see the item_name=, what I'm wanting to do is put any items that return true from the isset variables above into that, then separate them by commas. So when the paypal screen shows up it will show DS-1,DS-3 or whatever packages have been ordered? Plus I'll be entering them into mysql How would I do that? I was thinking maybe some type of an array?
You could use an array, but it's faster just to build that part of the query string by hand: // no items to start $item_name = ''; // for each found item, append to the item name if (isset($_POST['checkbox1'])) $item_name .= ',DS-1'; if (isset($_POST['checkbox2'])) $item_name .= ',DS-2'; if (isset($_POST['checkbox3'])) $item_name .= ',DS-3'; if (isset($_POST['checkbox4'])) $item_name .= ',DS-4'; if (isset($_POST['checkbox5'])) $item_name .= ',DS-5'; if (isset($_POST['checkbox6'])) $item_name .= ',DS-6'; // strip off leading ',' and encode $item_name = urlencode(ltrim($item_name,',')); // send header (make sure you scroll to the end for the added argument!) header("location: https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=your@webworld.com&amount=$total&item_name=$item_name"); PHP: