Background: I have a form with multiple submit buttons (about 25) all of which will send to an external .php file. This will track which is clicked, add to MYSQl database and then use the header to go to the corresponding html page based on the value of the submit. It works great when it works...
Problem: This only works 2 - 3 times, then I will see a page with text that says "No data received" "ERR_EMPTY_RESPONSE" (Chrome - same issue on all broswers). It seems that the header doesn't work as it leaves me at the .php itself.
Example: I click a submit button on the main page, I am taken to the corresponding page, I go back to main page, click another button, it works again, go back to main page, it then gives me an error page. Then error page from then on out.
Code:
submit button example:
<button type="submit" value="ALT_2_3_W1" name="altnum" id="ALT_2_3_W1-submit" class="">Explore</button>
php:
$database = 'DATABASE NAME';
$server = mysql_pconnect($db_host, $db_username, $db_password);
$connection = mysql_select_db($db_name, $server);
if (!$connection) {
die('Not connected : ' . mysql_error());
}
//VARIABLES FROM FORM FIELDS
$alternativenum = $_POST['altnum'];
header('Location:map_'.$alternativenum.'.html');
$myquery = "UPDATE altDashboardTracking SET altCount = altCount + 1 WHERE altName = '".$alternativenum."' LIMIT 1";
$query = mysql_query($myquery);
?>
Could this be a database connection issue?
I could use hard links but I need to be able to track which of the submit buttons are being clicked the most for a study.
Other information: The MYSQL database is being used to output to some D3.js charts so I would prefer to use this method and have it work.
Thanks for all of your responses.
Eric