Hi all I've wrote this an hour ago and struggling to realise why I keep getting "Internal Server Error", which I know in this instance the cause is the header().

PHP Code:

if(isset($_POST['cmd']) && isset($_POST['hosted_button_id']) && isset($_POST['diskSpace']) && isset($_POST['bandwidth']) && isset($_POST['subdomains']) && isset($_POST['additionalftp']) && isset($_POST['mysqldatabases']) && isset($_POST['emailforwarding']) && isset($_POST['autoresponders']) && isset($_POST['emaildistribution']) && isset($_POST['mailboxes']) && isset($_POST['oneclick']) && isset($_POST['operatingsystem'])){
$cmd $_POST['cmd'];
$custom =  md5(date("his").microtime());
$hosted_button_id $_POST['hosted_button_id'];
$diskSpace $_POST['diskSpace'];
$bandwidth $_POST['bandwidth'];
$subdomains $_POST['subdomains'];
$additionalftp $_POST['additionalftp'];
$mysqldatabases $_POST['mysqldatabases'];
$emailforwarding $_POST['emailforwarding'];
$autoresponders $_POST['autoresponders'];
$emaildistribution $_POST['emaildistribution'];
$mailboxes $_POST['mailboxes'];
$oneclick $_POST['oneclick'];
$operatingsystem $_POST['operatingsystem'];
$con mysql_connect('localhost''''');
$db mysql_select_db(''$con);    
mysql_query("SELECT * FROM `hostingAccounts` ORDER BY id")){
$createTable = ("CREATE TABLE IF NOT EXISTS `hostingAccounts` (
        `ref` TEXT NOT NULL, 
        `disk_space` TEXT NOT NULL, 
        `bandwidth` TEXT NOT NULL, 
        `sub_domains` TEXT NOT NULL, 
        `additional_ftp` TEXT NOT NULL, 
        `mysql_databases` TEXT NOT NULL, 
        `email_forwarding` TEXT NOT NULL, 
        `auto_responders` TEXT NOT NULL, 
        `email_distribution` TEXT NOT NULL, 
        `mailboxes` TEXT NOT NULL, 
        `one_click_apps` TEXT NOT NULL, 
        `operating_system` TEXT NOT NULL, 
        `payer_email` TEXT NOT NULL, 
        `first_name` TEXT NOT NULL, 
        `last_name` TEXT NOT NULL, 
        `payer_id` TEXT NOT NULL, 
        `address_street` TEXT NOT NULL, 
        `address_city` TEXT NOT NULL, 
        `address_state` TEXT NOT NULL, 
        `address_zip` TEXT NOT NULL, 
        `address_country` TEXT NOT NULL
        ) ENGINE = MYISAM CHARACTER SET utf8 COLLATE utf8_general_ci;"
mysql_query("INSERT INTO `hostingAccounts` (ref, disk_space, bandwidth, sub_domains, additional_ftp, mysql_databases, email_forwarding, auto_responders, email_distribution, mailboxes, one_click_apps,  operating_system) VALUES ('$custom', '$diskspace', '$bandwidth', '$subdomains', '$additionalftp', '$mysqldatabases', '$emailforwarding', '$autoresponders', '$emaildistribution', '$mailboxes', '$oneclick', '$operatingsystem')") or die (mysql_error());
$host "https://www.paypal.com";
$path "/cgi-bin/webscr";
$data "cmd=".$cmd."&hosted_button_id=".$hosted_button_id."&custom=".$custom;
$data urlencode($data);
header("POST $path HTTP/1.1\r\n" );
header("Host: $host\r\n" );
header("Content-type: application/x-www-form-urlencoded\r\n" );
header("Content-length: " strlen($data) . "\r\n" );
header("Connection: close\r\n\r\n" );
If someone could explain why this is not going to the supposed route, it would be much appreciated!