Here is my code:
$id = $_GET['id'];
$data = $_POST['name'];
$data1 = $_POST['id'];
$c = 0;
foreach ($data1 as $key => $value) {
$sql = "UPDATE ".$table_comp." SET score = " . $data[$c][$value] . " where id = " . $value .";" ;
mysqli_query($connect,$sql);
$c++;
}
header('Location: http://www.csscorecard.com/admin/?id=$id');
I have problem in my redirect there is an error:
Warning: Cannot modify header information - headers already sent by (output started at /home/csscorecard/public_html/wp-content/themes/twentyseventeen/ajax/submit.php:3) in /home/csscorecard/public_html/wp-content/themes/twentyseventeen/ajax/submit.php on line 54
use javascript instead of headers.
you can use this code to redirect
<?php
echo "<script>window.location.href = 'http://www.csscorecard.com/admin/?id=".$id."'</script>";
?>
Its quite complex to give answer in this case without seeing whole file code. In many cases this error shown. but for header location you should put exit:
exit(header("Location: http://www.csscorecard.com/admin/?id=$id"));
You can add ob_start();
top of the file